[cl-ppcre-devel] differing results between cl-ppcre and perl -- operator precedence?
Cyrus Harmon
ch-lisp at bobobeach.com
Fri Apr 13 11:55:24 UTC 2012
In trying to track down a problem matching a cxml-rng pattern in soiree, I came across the following somewhat odd behavior in cl-pppcre.
In perl, I see:
(sly at barbaresco):~/projects/soiree$ echo "Ta" | perl -ne 'print if /^T(a)|(b)$/'
Ta
(sly at barbaresco):~/projects/soiree$ echo "Tb" | perl -ne 'print if /^T(a)|(b)$/'
Tb
Whereas with cl-ppcre, I see:
SOIREE-ICALENDAR> (cl-ppcre:scan-to-strings "^T(a)|(b)$" "Ta")
"Ta"
#("a" NIL)
SOIREE-ICALENDAR> (cl-ppcre:scan-to-strings "^T(a)|(b)$" "Tb")
"b"
#(NIL "b")
Parsing the string suggests that the order of operations may be different in cl-ppcre than in perl. Is this intentional?
SOIREE-ICALENDAR> (cl-ppcre:parse-string "^T(a)|(b)$")
(:ALTERNATION (:SEQUENCE :START-ANCHOR #\T (:REGISTER #\a))
(:SEQUENCE (:REGISTER #\b) :END-ANCHOR))
thanks,
Cyrus
More information about the Cl-ppcre-devel
mailing list