| To: | scsh-news@zurich.ai.mit.edu |
|---|---|
| Subject: | Re: Usage of Shivers' SRE regular expression notation |
| From: | Andreas Bernauer <andreas.bernauer@gmx.de> |
| Date: | Wed, 19 Feb 2003 11:11:40 +0100 |
| Mail-followup-to: | scsh-news@zurich.ai.mit.edu |
On Tue, Feb 18, 2003 at 04:21:25PM +0900, Alex Shinn wrote:
> Anton> (rx (w/nocase (: (or "href" "file") (* whitespace) "=" (*
> Anton> whitespace) "\"" (submatch (* (~ ("?\"")))) "\"")))
>
> For comparison, the Perl 5 equivalent is
>
> /(href|file)\s*=\s*"([^"]*)"/i
>
> the equivalent (overly-) commented, structured version is
>
> my $KEYWORDS = "( href | file )";
> my $OPTWHITE = "\s*"; # zero or more whitespace chars
>
> /
> $KEYWORDS # match either an href or file
> $OPTWHITE # optional whitespace
> =
> $OPTWHITE
> "
> ( # start group
> [^"] # a non-quote character
> * # ... repeated zero or more times
> ) # end group
> "
> /xi
>
What about sub-matches [\(...\)] in the interpolated strings and the
"basic" string? Which one can I access?
--
Andreas.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: Usage of Shivers' SRE regular expression notation, Tom Lord |
|---|---|
| Next by Date: | Re: scsh/scheme48 bug on IRIX, Michael Sperber [Mr. Preprocessor] |
| Previous by Thread: | Re: Usage of Shivers' SRE regular expression notation, Tom Lord |
| Next by Thread: | Re: Usage of Shivers' SRE regular expression notation, Michel Schinz |
| Indexes: | [Date] [Thread] [Top] [All Lists] |