Question:
[a-zA-Z0-9!$*trn]
Answer:
Usually, even characters act as ordinary characters in regular expression. However, when they appear in the character class and there are other characters in front and behind, their behavior will change slightly. In these specific circumstances, they have special uses.
matching the character []
Directly use the characters:
The characters in the character classindicate itself.
-
Example -
: equivalent to .
: matching A, B, C, or connected characters. Pay attention to the position of the character.
[-abc]
The above is the detailed content of How can I Use Hyphens Correctly in Regular Expression Character Classes?. For more information, please follow other related articles on the PHP Chinese website!