Javascript regex for symbol but not space

I want to test a string for a symbol (e.g. $%^&*) so I use the following which works well:


But, a space also matches this. What I really want is to test for a symbol but not a space, I’m trying the following but a space is matching


Is there a better way to do this?

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.