[cl-ppcre-devel] strange scan results
Edi Weitz
edi at weitz.de
Wed Nov 30 12:08:35 UTC 2011
Hi Noldus,
What Hans says. The regex engine usually stops at the first match, so
you have to be careful, because you'll get what you asked for.
General questions about regular expressions are best answered by one
of the numerous online articles or for example by the good O'Reilly
book. I might also shamelessly recommend my "Regex Coach"
application.
As for the other question: You should enter the regex string into your
Lisp listener and see what you'll get back. This has something to do
with how CL treats backslashes in strings - there's also a section
about this in the CL-PPCRE documentation.
Cheers,
Edi.
On Tue, Nov 29, 2011 at 4:51 PM, Noldus Reijnders
<n_reijnders at hotmail.com> wrote:
> Hey again!
>
> I came across something of which I don't understand why it happens.. When I
> do this:
>
> (scan "[a-z]*" "<test>")
>
>
>
> I get:
> 0
> 0
> #()
> #()
>
>
> while I expect:
> 1
> 4
> ...
> ... (I don't get the registers.. Although it isn't necessary for me right
> now, could you maybe explain this as well if you have the time? I think it
> has something to do with back referencing, but I'm not sure.)
>
>
> Also, when I do this:
>
> (scan "[\xD8-\xF6]*" "<test>")
> 0
> 6
> #()
> #()
>
> while I expect to get nil.
>
> It seems as if the scanner doesn't do anything if the first character is
> part of the regex in the first example (because if I add a angular bracket
> to the front it does find it) and in the second it matches everything while
> the hexcode range is far outside the strings range so it shouldn't find
> anything. Am I doing something wrong?
>
>
> Greatings,
> Noldus
>
> _______________________________________________
> cl-ppcre-devel site list
> cl-ppcre-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/cl-ppcre-devel
>
More information about the Cl-ppcre-devel
mailing list