Question
Regular expression to determine username
Solution
preg_match('/'/^s*$|^c:\con\con$|[%,*"st&'\]/', $username)
How do you understand copying code?
Thank you everyone
Copy PHP content to clipboard PHP code: [%,*"st&'\]
This part can basically be understood, asterisk, double quotation mark, space character, tab character, less than, greater than, &, single quotation mark, but why use two backslashes?
And what do the last four backslashes mean?
[ ]
Reference answer
[img]http://www.111cn.cn/bbs/images/smilies/default/funk.gif[/img]
Reference answer
Usernames with symbols, whitespace characters, and line breaks are prohibited.
I feel like the regular author is a bit perverted.
Reference answer
I don’t quite understand..Explain.
^s*$|^c:.
^ What does it mean
Why use two s
c:
What does it mean again
Reference answer
/^
The strangest thing is here. ^ is placed in the middle of the expression, I really can’t think of what it means..
Reference answer
s*
Then why use two
here?
This is a single quote. Logically speaking, one is enough
Reference answer
Du Jiang's book has talked about it. s t r are all there...
Reference answer
Can’t you answer directly? [img]http://www.111cn.cn/bbs/images/smilies/default/42.gif[/img]
Reference answer
con\con What does this do?
Reference answer
Can you tell me what you know?