agahi
-
Posts
2 -
Joined
-
Last visited
Posts posted by agahi
-
-
Hi everybody
I am trying to figure out a regex that match any combination/order of digits and backslashes for example it should matches all the following strings:
$string = "1423/3838/894789/9387";
or
$string = "/73636/83/398/3";
or
$string = "3//33/3838/7474/"
or
$string = "/";
or
$string = "636"
AND NOT:
$string = "a3434";
Any idea?
find any combination in any order of specific characters.
in Regex Help
Posted
Thanks Jacques, it worked perfectly.
I have a follow up question, lets say I am also certain that there is going to be less than 4 alphabetical characters there and I want to match that as well for example my string would be:
$string = "1423/3838/894789BLAH/9387";
or
$string = "/73636/83/398/3BLAH";
or
$string = "BLAH3//33/3838/7474/"
or
$string = "/BLAH";
or
$string = "636BLAH"
AND NOT because there are more than 4 alphabetical characters:
$string = "BELABELA3434";
I modified your code as follow but it didn't work.