I’m trying to match different abbreviations for the german word “Straße” (e.g. “Str” or “Str.”)
How can i escape the dot sign within the string?
\b(Str|Str.)\b
And how can i setup case-insensitive? It would be nice if the regex matches “str”, “sTr”, … too.
You escape special characters with
\.Also,
?makes the preceding token optional, so we can condense to:Finally, case insensitivity is specified with the
imodifier. How you specify modifiers depends on the language. In most cases they’re put after the closing delimiter of the regex: