2

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!

7
  • 1
    everthing FROM this regexp? Please clearify your question Nov 2, 2013 at 15:25
  • i need a regular expression similar to this one that returns the same characters without numbers Nov 2, 2013 at 15:28
  • this regular expression includes ZàáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ for example Nov 2, 2013 at 15:28
  • You just want a-z and A-Z? Nov 2, 2013 at 15:31
  • i want '-`´plus the characters the \w matches without numbers Nov 2, 2013 at 15:38

2 Answers 2

2

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.

2
  • the problem is that this also matches []()*? etc, etc Nov 2, 2013 at 15:47
  • 1
    Because the '-` creates a range. Best to put the - at the end of the [].
    – MikeM
    Nov 2, 2013 at 16:53
1

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}$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.