我有Drupal 7
站点。我正在使用贡献的"现场验证"模块进行验证。
我需要验证文本框。这个文本框应该只允许字符,数字&空间
我尝试使用以下正则表达式,但不允许使用空格。
[a-zA-Z0-9]
^[a-zA-Z0-9_ ]*$
/^[a-z'd'-_'s]+$/i
请注意,我在这里谈论的是drupal的FieldValidation模块中的regex。
这应该适用于^['w's]+$
^ - assert position at start of the string
'w - Matches alphanumeric (same as [a-zA-Z0-9_])
'd - Matches digits (same as [0-9])
+ - Match the previous element one or more times (as many as possible)
$ - assert position at end of the string
这是允许在文本框中写入的内容
ABCdef 123_
附言:如果此^['w's]+$
不起作用,请尝试/^['w's]+$/