Reputation: 107
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!
Upvotes: 2
Views: 1127
Reputation: 324620
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.
Upvotes: 2
Reputation: 70722
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}$
Upvotes: 1