Scheepers, I'm sorry to say your solution has several problems. Within a character class, most of the characters that usually have special meaning, don't. So there's no need to escape the '*', '+', '/' characters--but
you should have escaped the '-' because character classes use it to define a range, as in "[a-z]" (but if it's the very first or last character in the set, the hyphen gets treated as a literal character). The '|' shouldn't be in there at all: the OR is implicit in a character class, so the pipe just gets treated a another literal character. Also, when you're creating a regex in a String literal, you have to use
two backslashes to escape a character, not one.
Jim, the lookingAt() method means the regex matches the beginning of the target text, but not necessarily all of it. You probably want the find() method, which looks for the next match anywhere with the target. Here's a sample app to demonstrate:
Also,
input.substring(match.start(),match.end()) is exactly the same as
match.group().