I'm trying to define a regex pattern that searches for a caret character, but since ^
is used for negation, I'm not sure how to define the pattern. I'm trying to make the program find a string that is a letter then a caret then a number (as you may have guessed, this is a mathematical term), such as "x^23"
. This is the line I tried:
String caseFour = "[a-zA-Z]" + "^" + "\\d+";
It's not working. Can anyone help me out?