W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2007

RE: regex help

From: Michael Kay <mike@saxonica.com>
Date: Mon, 22 Jan 2007 00:00:37 -0000
To: "'Your Name'" <ratesnow@mortgage-rates-now.org>, <xmlschema-dev@w3.org>
Message-ID: <00b801c73db8$599df770$2300000a@turtle>

I agree. If you're only giving a match or no-match result, as in XML Schema,
greediness is irrelevant. 

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Your Name
> Sent: 19 January 2007 05:01
> To: xmlschema-dev@w3.org
> Subject: Re: regex help
> 
> 
> Just a note on the greediness mentioned here...
> 
> My understanding is that the greediness of a regular 
> expression is only an issue when you are capturing the values 
> of sub-patterns within the target data.  (e.g. in Perl 
> 'ML123' =~ /ML(\d+)/; captures 123 into $1.) When only doing 
> matching, eventually, if possible, the pattern will be 
> matched irrespective of whether greedy or non-greedy matching is used.
> 
> Greediness just affects whether the regular expression engine 
> attempts to grab lots of content for a sub-expression in it's 
> first attempt and them back track, or attempts to capture the 
> minimal amount in its first attempt and then forward track 
> (not sure if that's a proper term!).
> 
> If anyone's opinion differs, please let me know
> 
> 
> 
Received on Monday, 22 January 2007 00:00:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:57 GMT