0

Hi guys i'm wondering how to make a regex that doesnt allow spaces or numbers my current code works for numbers and space. I want numbers or spaces.

/([0-9])\s+/g

only works on numbers with spaces at the end, need it to work for numbers and spaces in any order

Codegenesis G
  • 79
  • 1
  • 1
  • 9
  • 2
    Possible duplicate of [and/or operator in regular expression](http://stackoverflow.com/questions/8020848/and-or-operator-in-regular-expression) – PoX Feb 06 '16 at 01:12

1 Answers1

3

Include the space character in your square brackets:

[0-9\s]+

Or if you're looking for excluding spaces and numbers (\d means a digit, same as 0-9):

[^\d\s]+
tokamak
  • 541
  • 3
  • 11