All Questions
82 questions
1
vote
1
answer
239
views
Regex to capture possible US date entries
The Problem
I'm relying on plaintext entry to capture dates.
End users are urged to enter as MM-DD-YY, but it'll be great to account for as many possibilities.
US ...
3
votes
3
answers
401
views
Regex to extract portions of string about shipment
The Problem
I'll be extracting up to 4 parts of a String that come from user-input.
All 4 parts need to be in order i.e. (1-4) below in that order
The first capturing group is required and the last ...
0
votes
1
answer
68
views
function to check if anchor tags contain href attributes with 301
I made this function to test if the content has 301 redirections.. Please can you help me optimize it better because it's too slow
...
2
votes
1
answer
113
views
Validator and Sanitizer for HTML 5 attribute regex according to current HTML living standard
According to https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 an HTML 5 attribute name is defined like this:
Attribute names must consist of one or more characters other than
controls, ...
3
votes
1
answer
473
views
Parse and format var_dump data to become more readable
I have a class that exposes var_dump data in order to get better human readable layout.
I have achieved this with a lot of ...
1
vote
1
answer
63
views
Feedback Request on Title Capitalization Function Converted From JavaScript to PHP
I have a function in JavaScript that converts a string value to title case using APA style:
...
2
votes
1
answer
693
views
Replace anchor tags and force create new tag with custom attributes
I'm just use the add_filter('the_content', function($content){}); for filtering anchor tags in a post.
Basically, I want filter anchor tags to appropriate format. ...
2
votes
1
answer
122
views
Function to convert "path" into regular expression
This function converts a string like:
/{?lang(2-5):lowercase}/{page(2+):lowercase}/{article}-{id:integer}*.html*
Into the following regular expression:
...
0
votes
1
answer
3k
views
Extract HTML tags and its content from a string [closed]
Goal
I want to extract HTML tags and its content from a string. The content (input) is queried from WordPress database.
Sample data (input)
I extract this dummy data from my WordPress database: ...
4
votes
3
answers
3k
views
Regex match comments and quotes
UPDATE
New regex - covers escaped slashes and uses lazy qualifiers:
...
0
votes
2
answers
165
views
Sanitizing name strings using PHP
Functionality:
This method removes a list of specific terms (e.g., LLC, INC, Inc, Company, etc.) from a list of public companies names. It is part of a class that can be viewed in this link.
I'd ...
2
votes
1
answer
155
views
Adding prefixes to headers in markdown
I'm adding prefixes to headers in markdown using a script. For example, if I have:
# Hello
## World
### Let's add
## Some headers
### Yay!
# Foo
## Bar
I ...
3
votes
3
answers
284
views
Retrieve words from dictionary when they meet letter requirements
I have a set of functions that retrieve words from some arbitrary dictionary based on what letters they have. For example, this function gets words that use only the specified letters:
...
0
votes
2
answers
6k
views
Remove all html special chars
Before saving the input from users in the database, I am using the below function to replace all HTML special chars. All my users will always be using the English Language.
Option 1
...
2
votes
1
answer
3k
views
Regex for a string with at least a letter and no repeating dash
I had a problem a few days back and had to find a regex that matches a string that:
Contains only letters in the alphabet [a-z0-9-] so lowercase latin letters, ...