0

I have this regex that matches any string that contains one or more letters followed by one or more numbers

[A-Za-z].*[0-9]

I'd like to modify this to not allow spaces, which looks like can be done with [^ ]

I've tried several different ways to modify my existing regex, but nothing seems to work, it always allows spaces in my string. I've tried these:

[A-Za-z].*[0-9]+[^ ]

[A-Za-z].*[0-9].+[^ ]

[A-Za-z].*[0-9].*[^ ]

What's the right way for me to do that?

Steven
  • 18,761
  • 70
  • 194
  • 296

0 Answers0