I would like to find and match a pattern of character "ab" with any number. I've been trying
.*([0-9]+ab)
this seems to work but is only finding any matches at the end of a string, not in any location of the string.
testString = "if this was a test string 123ab"
TestStringNotFound = "if this 123ab string was a test"
however by using
.*([0-9]+ab).*
it seems to look at any location of the string but from my understanding
.
is just referring to any character and *
was any digit. So I'm struggling to understand why adding .*
to the end will return the specified match anywhere in the string.
I've been using this documentation as a guide gave me the impression that ([0-9]+ab)
would be the way to write this expression. Thanks for the help.