php - Regex with the following conditions -
I am trying to understand how regex works by matching a regex to the following conditions:
- The string must start with one or more alphanumeric characters.
- The string should be followed by the '@' sign
- After the string 'asa' immediately after the string '@'
- string in a string Or more of 0 and / or 1
- string must be followed other string
- after string
- 'abc' was thinking that E person may offer some tips:
$ pattern = "/ ^ [a-zA-Z0- 9 @] + @ + [Asaa] + [01] /"; $ Theme = "abcB123Ccac @ asa01"; Echo preg_match ($ pattern, $ theme)? 'Match': 'no match';
I'm around Phase 4 and now I'm stuck, collecting one or more special characters and / or numbers, no letters
You can try regex below.
^ [azza-j 0-9] + asa [01] + @ [^ azza-jade] + ac $
The code will be,
$ pattern = "~ ^ [a-za-z0-9] + @ asa [01] + @ [^ a-za-z] + abc $ ~"; $ Theme = "abcB123Ccac @ asa01"; Echo preg_match ($ pattern, $ theme)? 'Match': 'no match';
-
The string must start with one or more alphanumeric characters.
^ [A-Za-z0-9] +
-
followed the string followed by a '@' sign Should be
@
-
string '@'
asa
-
String must be followed by a string containing one or more special characters and / or any other @
@ < / Code>
numbers, letters (except letters) -
ABC '' ABC ''
ABC $
>
[^ a-za-z] +
Comments
Post a Comment