|
|
Browse by Tags
All Tags » preg_match
Showing page 1 of 2 (14 total posts)
-
Im using the following piece of php code to validate the correct format of a web address.
www.mysite.com should return true
www.mysite.coy should return false and trigger the... die (comment)
unfortunately both aaddresses return true. I thought that as coy wasnt in my list of tld's that it would return true.
Does ...
-
I have this kind of strings:
{test1|test2|test3}
This is easy to match with something like:
~{(.*?)}~
But I would like to be able to match strings like:
{test1|test2|test3{subtest1|subtest2}}
or
{test1|test2|test3{subtest1|subtest2{subsubtest1|subsubtest2|subsubtest3}}}
I can't figure out how I could match that in the ...
-
Hi,
We have a control system, which sends automated messages in the following syntax:
##TO admin, user1, user2
message1
##TO user2, user4
message2
##TO user5
message3
I think the syntax is obvious. From this message I need to create as many messages as many different users are after the ##TO fields. In this case ...
-
Hi all!
I'm starting to get my head around regular expressions for work, but there are still bits and pieces my mind just draws a blank with.. At the moment I'm trying to validate a text string to check if it has 5 specific values, and extract them, using PHP. Here are a few examples of valid labels
[cake] cupcake 50kg $100 ...
-
Hi folks,
I am trying to extract search terms from a string to process (in PHP). It is a free-text input box where the user can enter terms to search a database table, using AND'd, OR'd, and NOT'd expressions.
Sample strings:
AND this,that NOT you,me
OR red,biue NOT white
In the first example, I would like to ...
-
I am working on making a bbcode system with php using preg_replace(), and I am making it so that other tags will not work inside of a code block. This is the code I am currently using, it almost works:
/(?!\[code\])(.*)(\[b\])(.+)(\[\/b\])(.*)(?<!\[\/code\])/Usi
what I want it to do is if [*code] and [*/code] are around the text inside, ...
-
Hi,
I'm using PHP to parse an incoming email. I wish to be able to match then store URL's contained in the email message.
I just need to figure out the RegEx to match URL's. I've been currently building and testing ...
-
I have the following regex statement I'm trying to run in PHP.
(?<!(end\s?zone|lower|upper)\s?)(view)
Testing against the following string: (matches in bold)
"The endzone view goes hi upper view and he goes view and then goes view and view and view!!!"
Notice "upper view" and "endzone view" are ...
-
Hello all,
I'd like to check on a php page that a text string complies with the following rule : Contain numbers, in ascending order, with only , or - as separators
The numbers represent requested items (like pages to print), my purpose is then to count the ...
-
Hi,
I'm trying to write a regular expression that converts a 'pretty URI' into a standard one in the Apache .htaccess file. I'm doing it in PHP (preg_match) first, since both seem to work similarly.
An example:
page/c-cssstyle/t-template/p-pagenumber/ needs to be converted into ...
1
|
|
|