I’m new to regular expression and I having trouble finding what “\’.-” means.
'/^[A-Z \'.-]{2,20}$/i'
So far from my research, I have found that the regular expression starts (^) and requires two to twenty ({2,20}) alphabetical (A-Z) characters. The expression is also case insensitive (/i).
Any hints about what “\’.-” means?
The character class is the entire expression
[A-Z \'.-], meaning any ofA–Z, space, single quote, period, or hyphen. The\is needed to protect the single quote, since it’s also being used as the string quote. This charclass must be repeated 2 to 20 times, and because of the leading^and trailing$anchors that must be the entire content of the matching string.