I am using this Regex
in my Flutter App to find words enclosed by single-quotes
that end with a .tr
:
r"'[^'\]*(?:\.[^'\]*)*'s*.trb"
Now I need another expression that is almost the same but looks for words enclosed by dobule-quotes
, ending with .tr
and might contain escaped single-quotes.
I tried simply changing the single quotes to double quotes from the first expression, but Flutter is giving me errors… I need to escaped some characters but I can not make it work. Any idea?
An edge case it should match is:
"Hello, I'm Chris".tr
2
Answers
You may use this regex for double quoted text that can have any escaped character followed by
.tr
and word boundary:RegEx Demo
you need to use
before every
"
in your RegExp’s source, try this: