May I ask questions about the code understanding, could you tell me the following red code preg_match ('/[^ a-z0-9 _]/I', $ act) should be how to understand? Thank you for your help.
$ Act = Get ('Act ');
If (! Isset ($ act {0 })){
$ Act = 'Pa ';
} Elseif (preg_match ('/[^ a-z0-9 _]/I', $ act )){
Exit;
}
Reply to discussion (solution)
/[^ A-z0-9 _]/I
Match characters other than letters, numbers, and underscores
Preg_match ('/[^ a-z0-9 _]/I', $ act
Preg_match is a php regular expression matching method.
'/[^ A-z0-9 _]/I' is a matching regular expression
$ Act is a string used to check for matching
Regular Expression Description
A-z indicates that all lowercase letters are matched.
0-9 indicates matching numbers 0 ~ 9
_ Matches the underline
The entire sentence indicates whether $ act is composed of lower-case letters, numbers, or Underscores. if it is true, it is false.
Could you tell me the following red code preg_match ('/[^ a-z0-9 _]/I', $ act) How should I understand? Thank you for your help.
$ Act = Get ('Act ');
If (! Isset ($ act {0 })){
$ Act = 'Pa ';
} Elseif (preg_match ('/[^ a-z0-9 _]/I', $ act )){
Exit;
}
Thank you for your reply.
/[^ A-z0-9 _]/I
Match characters other than letters, numbers, and underscores
Thank you for your reply to fdipzone.
I basically understand the meaning of this code.
However, I have another question:
The entire sentence indicates whether $ act is composed of lower-case letters, upper-case letters, numbers, or Underscores. if it is true, otherwise it is false.
Because the regular expression is followed by/I
Is that true?
Preg_match ('/[^ a-z0-9 _]/I', $ act
Preg_match is a php regular expression matching method.
'/[^ A-z0-9 _]/I' is a matching regular expression
$ Act is a string used to check for matching
Regular Expression Description
A-z indicates that all lowercase letters are matched.
0-9 indicates matching numbers 0 ~ 9
_ Matches the underline
The entire sentence indicates whether $ act is composed of lower-case letters, numbers, or Underscores. if it is true, it is false.
Thank you for your reply.
I basically understand the meaning of this code.
However, I have another question:
The entire sentence indicates whether $ act is composed of lower-case letters, upper-case letters, numbers, or Underscores. if it is true, otherwise it is false.
Because the regular expression is followed by/I
Is that true?
If (preg_match ('/[^ a-z0-9 _]/I', $ act )){
Exit;
}
If $ act contains characters other than letters, numbers, and underscores, exit
Preg_match ('/[^ a-z0-9 _]/I', $ act
Preg_match is a php regular expression matching method.
'/[^ A-z0-9 _]/I' is a matching regular expression
$ Act is a string used to check for matching
Regular Expression Description
A-z indicates that all lowercase letters are matched.
0-9 indicates matching numbers 0 ~ 9
_ Matches the underline
The entire sentence indicates whether $ act is composed of lower-case letters, numbers, or Underscores. if it is true, it is false.
Thank you for your reply.
I basically understand the meaning of this code.
However, I have another question:
The entire sentence indicates whether $ act is composed of lower-case letters, upper-case letters, numbers, or Underscores. if it is true, otherwise it is false.
Because the regular expression is followed by/I
Is that true?
Yes.
You can find and learn simple regular expressions.