I want to create a php regex to detect that a phrase is not pure numbers. My phrase is not in English so using patterns which contain [a-z] and [A-Z] is not useful. point: I guess the pattern I need is anything except ^([0-9]{1,})$
Asked
Active
Viewed 21 times
0
-
You may use `/^(?!\d+$)/u` or `/^(?!\d+$).*$/su` – Wiktor Stribiżew Oct 07 '16 at 08:51
-
Just match the strings with this regex and put a `!` operator before `preg_match`! You don't have to do magic in the regex itself – Mohammad Jafar Mashhadi Oct 07 '16 at 08:52
-
Note I marked as a dupe because a lot of these scenarios are described in the http://stackoverflow.com/a/37988661/3832970 post, and your scenario is dealt with in the *a **string equal to some string** (say, not equal to `foo`):* section, where you just can use your own pattern `[0-9]{1,}` instead of `foo`. – Wiktor Stribiżew Oct 07 '16 at 08:59