[英]Php regex, match pattern?
I am trying to make a regex that will match this pattern, 我正在尝试制作一个与该模式匹配的正则表达式,
Must be 40 characters long, 必须为40个字符长,
Must contain only letters and numbers, 只允许使用字母和数字,
Must contain no spaces, 不得包含空格,
Case insensitive, 不区分大小写,
So far I have come up with this but it does not work; 到目前为止,我想出了这个办法,但是没有用。
/^[0-9a-f]+$/i
Thanks 谢谢
/^[0-9a-f]{40}$/i
should do the trick. 应该可以。 The number in curly brackets defines the number of characters.
大括号中的数字定义字符数。
Try this regex: 试试这个正则表达式:
/^[\da-z]{40}$/i
If you really only want the letters af then use: 如果您真的只想要字母af,请使用:
/^[\da-f]{40}$/i
试试这个: /^[0-9a-z]{40,40}$/i
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.