[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51458: grep PCRE - '^' and '$' are not recognized as begin and end o
From: |
Carlo Marcelo Arenas Belón |
Subject: |
bug#51458: grep PCRE - '^' and '$' are not recognized as begin and end of line for multiline strings |
Date: |
Mon, 8 Nov 2021 12:29:19 -0800 |
older versions of PCRE support in grep used multiline mode by default, which
seems to be required by your expression to work and is also on by default in
the regex site.
you can add it back using an internal option[1] from PCRE, as shown in the
following modified expression from your original example:
/\A(?m:\s*^(?:#\w+.*\s*|extern\s+.+)$)*+(?<namespace>\s*namespace(?:\s+utTestNamespace\s*(?>(?<block>{(?:[^{}]*(?&block)*)*}))|(\s*[\w:]*\s*{)(?&namespace)\s*}))\s*\z/
Carlo
[1] https://www.pcre.org/current/doc/html/pcre2pattern.html#internaloptions
- bug#51458: grep PCRE - '^' and '$' are not recognized as begin and end of line for multiline strings,
Carlo Marcelo Arenas Belón <=