does /xyz$/ match "xyz\\n" in pcre's multi-line mode? yes. Does it match also in not multi-line mode? also yes. *because there's a special case for \\n at the end of the string.* 😭
if you don't understand why this is confusing... pcre goes through several layers of irony when deciding whether to match something or not
I'm dealing with this by having the AST constructed with [\\n]?$ for the anchored predicate, so our basic dumb NFA now looks like this. What a mess. (The unused .* at each end are attachment points for the unanchored forms - those get trimmed away during conversion to DFA, later)
I'm annoyed because now I have to update all my tests for the NFA construction to expect the optional newline there.
You can follow @thingskatedid.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: