lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] Removing look behind assertion in regex used in test_coding_rules


From: Vadim Zeitlin
Subject: [lmi] Removing look behind assertion in regex used in test_coding_rules
Date: Tue, 13 Nov 2018 18:45:35 +0100

 Hello,

 There is one regex in test_coding_rules.cpp which uses a feature not
supported by ECMAScript regex syntax used by C++ std::regex: zero-width
look behind positive assertion. It is used in check_inclusion_order()
function in this regex:

    static boost::regex const r(R"((?<=\n\n)(# *include *[<"][^\n]*\n)+\n)");

 AFAICS it could be rewritten in the equivalent (but probably more
efficient and, at least IMO, much clearer) way using the zero-width
positive look _ahead_ assertion instead:

    static boost::regex const r(R"(\n\n(# *include *[<"][^\n]*\n)+(?=\n))");

 Am I missing something or could we make this change in order to make
eventual transition to std::regex easier? I could, of course, make a patch
with this change if you'd like, please let me know if you'd accept it.

 Thanks in advance,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]