Checking String for illegal characters using regular expression

后端 未结 5 1725
猫巷女王i
猫巷女王i 2021-01-25 21:02

I want to check a for any illegal character using the following regular expression in PHP. Essentially, I want to allow only alphanumeric and underscore (_). Unfortunately the

5条回答
  •  无人共我
    2021-01-25 22:00

    You have no repeater for one. You need a repeater such as +. As far as I can see without executing it, you check start of line and one character matching a-zA-Z0-9 and _ but nothing following that first character.

提交回复
热议问题