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@barbaresco):~/projects/soiree$ echo "Ta" | perl -ne 'print if /^T(a)|(b)$/' Ta
(sly@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
My Perl behaves differently. See below:
edi@miles:/tmp$ cat test.pl #!/usr/bin/perl
$a = "Ta"; $b = "Tb"; print "a: '$&'\n" if ($a =~ /^T(a)|(b)/); print "b: '$&'\n" if ($b =~ /^T(a)|(b)/);
edi@miles:/tmp$ perl test.pl a: 'Ta' b: 'b' edi@miles:/tmp$ perl -v
This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
Copyright 1987-2006, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
On Fri, Apr 13, 2012 at 1:55 PM, Cyrus Harmon ch-lisp@bobobeach.com wrote:
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@barbaresco):~/projects/soiree$ echo "Ta" | perl -ne 'print if /^T(a)|(b)$/' Ta
(sly@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
cl-ppcre-devel site list cl-ppcre-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cl-ppcre-devel
Our perls behave the same. I was seeing a match (to b only) and then my one-liner was printing the original string which matched, not the matched portion.
Thanks and sorry for the false alarm.
Cyrus
On Apr 13, 2012, at 5:12 AM, Edi Weitz wrote:
My Perl behaves differently. See below:
edi@miles:/tmp$ cat test.pl #!/usr/bin/perl
$a = "Ta"; $b = "Tb"; print "a: '$&'\n" if ($a =~ /^T(a)|(b)/); print "b: '$&'\n" if ($b =~ /^T(a)|(b)/);
edi@miles:/tmp$ perl test.pl a: 'Ta' b: 'b' edi@miles:/tmp$ perl -v
This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
Copyright 1987-2006, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
On Fri, Apr 13, 2012 at 1:55 PM, Cyrus Harmon ch-lisp@bobobeach.com wrote:
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@barbaresco):~/projects/soiree$ echo "Ta" | perl -ne 'print if /^T(a)|(b)$/' Ta
(sly@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
cl-ppcre-devel site list cl-ppcre-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cl-ppcre-devel
cl-ppcre-devel site list cl-ppcre-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cl-ppcre-devel
cl-ppcre-devel@common-lisp.net