Closed JakeWharton closed 1 year ago
You could also change your matching regex to match the whole thing but yeah I could see how this could be simpler.
I did that first but weirdly couldn't make it work. Something with MULTILINE option maybe? I very quickly landed at matchesPredicate
and didn't look much further.
Ah yeah multiline regex can get weird
A mixture of
contains
andmatch
, but only looks for a match within the string rather than against the whole thing.Implementation is basically
matchesPredicate(regex::containsMatchIn)
, but it's nice to not have to do that every time you want to switch from an exactcontains
to a fuzzy, regex-based one (or similarly, from matching the whole string to only part of a string).