0
votes
0
comments
40,408
views

regular expression to allow spaces between words

0 votes, 0.00 avg. rating (0% score)
I want a regular expression that prevents symbols and only allows letters and numbers. This regex works great but it doesn’t allow for spaces between words. ^[a-zA-Z0-9_]*$ For example, when using this regular expression “HelloWorld” is fine but “Hello World” does not match. How can I tweak it to allow spaces?