Hacker News new | ask | show | jobs
by o11c 1015 days 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 `\>`.

1 comments

Correction, `A\<B` is `(A&(\W|^))(\w&B)`, which matters if the A regex can match the empty string.