Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's easy to get the canonical answer:

$ man pcre2syntax

Where you'll find the following block under ANCHORS AND SIMPLE ASSERTIONS:

         $           end of subject
                       also before newline at end of subject
                       also before internal newline in multiline mode
So all the cases of "newline at/before end of subject" are covered here. Then, the question becomes "what is a subject?" Is it line-by-line? Are newlines included? What if we want multiline matching? That's where re.MULTILINE comes from, it's not "multiline matching" (sort of) it's "what is the subject of the regular expression that we're matching against"


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: