"HI?".matches("""[A-Z]\?""")
This returns false i don’t understand why. They should match
Hi,
There is a mistake: [A-Z]
only matches one character. The following works
"HI?".matches("""[A-Z]+\?""")
Cheers,
Martin
1 Like
That regex only matches one capital letter followed by a ‘?’. You
probably want
[A-Z]+?
or something else to make it match with more letters before the ‘?’.
Sorry my bad i was trying to condense what i really wanted to test and made a mistake. Problem solved. Thanks all!