[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] string-match-positions
From: |
Jim Ursetto |
Subject: |
Re: [Chicken-users] string-match-positions |
Date: |
Sun, 1 Feb 2009 15:05:14 -0600 |
On Sun, Feb 1, 2009 at 12:06 PM, Jörg F. Wittenberger
<address@hidden> wrote:
> I'm confused (about chicken/trunk):
>
> the current manual contains:
>
> [procedure] (string-match REGEXP STRING [START])
> [procedure] (string-match-positions REGEXP STRING [START])
> my usage (from pcre times):
>
> (string-match-positions compiled-match string offset flags)
>
> note: a 4th (flags) parameter used to be supported. BTW: What's the
> best way to replace it with irregx?
Hi,
string-match and string-match-positions never supported a flags
parameter. If you provided one in the rest argument, it was ignored.
The proper way was to provide a flag to REGEXP,
in the format (regexp STRING [IGNORECASE [IGNORESPACE [UTF8]]]). That
way still works:
(string-match (regexp "a.." #t) "ABC")
Another way was to use PCRE flags syntax in the re string itself,
which also still works:
(string-match (regexp "(?i:a..)") "ABC")
(string-match "(?i:a..)" "ABC")
irregex also accepts PCRE flags syntax, so this is equivalent:
(string-match (irregex "(?i:a..)") "ABC")
irregex accepts option flags as a list of symbols, which is nicer than (regexp):
(string-match (irregex "a.." 'i) "ABC")
Finally, you can use w/nocase in an SRE:
(string-match (irregex '(w/nocase (: "a" any any))) "ABC")
> But worst regex.scm:
> (define (string-match-positions rx str)
I don't know about this.
Jim