Regex allows only 1 character

后端 未结 6 1440
长情又很酷
长情又很酷 2021-01-22 03:50
$rex = \'/^[^<,\"@?=>|;#]$/i\';

I\'m having trouble with this regular expression. The idea is that the input fields are checked for certain chara

6条回答
  •  情话喂你
    2021-01-22 04:15

    You're asking for only one character. If you want multiple characters, get the pattern repeated, either like this (one or more times):

     $rex = '/^[^<,"@?=>|;#]+$/i';
    

    or like this (zero or more times):

     $rex = '/^[^<,"@?=>|;#]*$/i';
    

提交回复
热议问题