简体   繁体   English

正则表达式允许@

[英]Regular Expression to allow @

I have a regular expression check in Magento (php) that allows letters, digits and _- 我在Magento(php)中进行了正则表达式检查,该检查允许字母,数字和_-

here is the code 这是代码

$validate = new Zend_Validate_Regex('/^[\w-]*$/');

I am trying to get this to also allow the @ symbol, and as I probably find out, this would need a full rewrite of the regex, which I am no good at, can anyone help me find the correct Regexp 我试图让它也允许@符号,并且我可能发现,这将需要对regex进行完全重写,我不太擅长,任何人都可以帮助我找到正确的Regexp

您可以使用此正则表达式:

/^[\w@-]+$/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM