简体   繁体   中英

php regular expression match any word characters except numbers

I need to get everything from this regular expression except numbers, how can i do it ?

^[\w'-`´]{1,50}$

So, the problem here is that \\w matches numbers too, a and i don't want it to match numbers. I want the regular expression returning everything that is already returning except the numbers!

Something like this would work:

^(?=\D+$)[\w'`´-]{1,50}$

This will first assert that there are no digits in the string, then use your current check.

The - has been moved to the end, otherwise it has special meaning. Thanks MikeM for pointing that out.

I want '-`´ plus the characters that \\w matches without numbers

What's wrong with this if you want the specific characters and what \\w matches except for numbers?

^[a-zA-Z'`´_-]{1,50}$

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