Reputation: 20557
I have this regex here:
"\d+.?\d*\^\d+\.?\d*"
What it should be doing is finding something like 2^10
in a string like 1*1+2^10*1
but it comes back with 1+2^10
.
What am I doing wrong? I assume it is something to do with the .
?
Upvotes: 3
Views: 807
Reputation: 2067
In regular expressions, the .
character stands for "match any character". You will have to escape it:
"\d+\.?\d*\^\d+\.?\d*"
You can try out your regular expression using RegexPal
Upvotes: 6