Open artelse opened 2 years ago
When try to convert this common regex:
(rxt-pcre-to-elisp "^(?:ISBN(?:-1[03])?:? )?(?=[0-9X]{10}$|(?=(?:[0-9]+[- ]){3})[- 0-9X]{13}$|97[89][0-9]{10}$|(?=(?:[0-9]+[- ]){4})[- 0-9]{17}$)(?:97[89][- ]?)?[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X]$")
The debugger reports:Debugger entered--Lisp error: (rxt-invalid-regexp "Unrecognized PCRE extended construction `(?='") signal(rxt-invalid-regexp ("Unrecognized PCRE extended construction `(?='")) rxt-error("Unrecognized PCRE extended construction `(?%c'" 61)
Is this one of the PCRE limitations?
Hello artelse. I am currently working on a fork of pcre2el
. What exactly is the (?=
construction supposed to do? It would be nice if you could link documentation. I might be able to fix this. Ideally, there will be a mapping of ?=
to some rx
operator.
Hi, I took that regex from the Regular Expressions Cookbook chapter 4.13 of which an online version is here: https://www.oreilly.com/library/view/regular-expressions-cookbook/9780596802837/ch04s13.html
In the mean time constructed a regex that works for me, but it would be great if pcre2el
would cover these constructs.
It's a positive lookahead assertion: http://www.pcre.org/current/doc/html/pcre2syntax.html#SEC19
When try to convert this common regex:
(rxt-pcre-to-elisp "^(?:ISBN(?:-1[03])?:? )?(?=[0-9X]{10}$|(?=(?:[0-9]+[- ]){3})[- 0-9X]{13}$|97[89][0-9]{10}$|(?=(?:[0-9]+[- ]){4})[- 0-9]{17}$)(?:97[89][- ]?)?[0-9]{1,5}[- ]?[0-9]+[- ]?[0-9]+[- ]?[0-9X]$")
The debugger reports:Is this one of the PCRE limitations?