我做了这个正则表达式:
^[a-zA-Z0-9_.-]*$
支持:
letters [uppercase and lowercase]
numbers [from 0 to 9]
underscores [_]
dots [.]
hyphens [-]
现在,我想添加这些:
spaces [ ]
comma [,]
exclamation mark [!]
parenthesis [()]
plus [+]
equal [=]
apostrophe [']
double quotation mark ["]
at [@]
dollar [$]
percent [%]
asterisk [*]
例如,此代码仅接受上面的一些符号:
^[a-zA-Z0-9 _.,-!()+=“”„@"$#%*]*$
回报:
警告:preg_match():编译失败:偏移 16 处的字符类范围乱序