3 ms·
A lack of `^` is equivalent to prepending `(.*)`, then trimming the match span to the end of that capture. And similarly for a lack of `$` (but suddenly I remem
by o11c 3y ago
A lack of `^` is equivalent to prepending `(.*)`, then trimming the match span to the end of that capture. And similarly for a lack of `$` (but suddenly I remember how nasty Python was before `.fullmatch` was added ...).
More interesting is word boundaries:
`\b` is just `\<|\>` though that should be bubbled up and usually only one side will actually produce a matchable regex.
`A\<B` is just `(A&\W)(\w&B)`, and similar for `\>`.
- o11c 3y agoCorrection, `A\<B` is `(A&(\W|^))(\w&B)`, which matters if the A regex can match the empty string.