user1394187
user1394187

Reputation: 33

Regular expression for specific characters

I've been building this regular expression for a while and so far I've had not much luck. Anyways the regular expression is supposed to catch the following characters: {}[]+-*/,.();

The boolean expression below works fine except when it encounters a ')'

atom.matches("\\[\\+\\-\\*/,.\\(\\)\\}\\{\\};");

Thanks for any help in advance

Upvotes: 1

Views: 141

Answers (1)

jmar777
jmar777

Reputation: 39689

You should use a character class:

[{}[\]+*/,.()-]

More info: http://www.regular-expressions.info/charclass.html

Upvotes: 2

Related Questions