简体   繁体   中英

Php regex, match pattern?

I am trying to make a regex that will match this pattern,

Must be 40 characters long,

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:

/^[\da-f]{40}$/i

试试这个: /^[0-9a-z]{40,40}$/i

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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