I am in the process of converting a regex library (thousands of perl regex's) and have come across a major problem.
This is the expression that I have to translate into static xpressive :
(?<![A-ZÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝ]\. )[mM]\.(?! [A-ZÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝ]\. )
This expression has before
and after
negating validation conditions.
Which means that normally I should use ~after
and ~before
.
However, as there are multibyte characters, I have to put them in as string literals.
My initial attempt was therefore like this :
~after(range('A', 'Z')| as_xpr("À")| as_xpr("Á")| as_xpr("Â")| as_xpr("Ã")| as_xpr("Ä")|
as_xpr("Å")| as_xpr("Ç")| as_xpr("È")| as_xpr("É")| as_xpr("Ê")| as_xpr("Ë")|
as_xpr("Ì")| as_xpr("Í")| as_xpr("Î")| as_xpr("Ï")| as_xpr("Ñ")| as_xpr("Ò")|
as_xpr("Ó")| as_xpr("Ô")| as_xpr("Õ")| as_xpr("Ö")| as_xpr("Ø")| as_xpr("Ù")|
as_xpr("Ú")| as_xpr("Û")| as_xpr("Ü")| as_xpr("Ý") | as_xpr(". ") ) >>
(set= 'm', 'M') >> '.' >>
~before(range('A', 'Z')| as_xpr("À")| as_xpr("Á")| as_xpr("Â")| as_xpr("Ã")| as_xpr("Ä")|
as_xpr("Å")| as_xpr("Ç")| as_xpr("È")| as_xpr("É")| as_xpr("Ê")| as_xpr("Ë")|
as_xpr("Ì")| as_xpr("Í")| as_xpr("Î")| as_xpr("Ï")| as_xpr("Ñ")| as_xpr("Ò")|
as_xpr("Ó")| as_xpr("Ô")| as_xpr("Õ")| as_xpr("Ö")| as_xpr("Ø")| as_xpr("Ù")|
as_xpr("Ú")| as_xpr("Û")| as_xpr("Ü")| as_xpr("Ý") | as_xpr(". ") )
However, as this gives a variable number of characters, it will not compile.
Is there anyway that I can implement this regex correctly in static xpressive ?