Hi Bret,
Hah! That is neat Bret. I couldn't get the second one to
work but the first one was sweet as a nut. I understand that the
[^ ] means any characters that's not a space but how does it know
to return the whole word involved?
I don't recall seeing \b in regexps before what does it mean?
Apologies for the newbiness.
Thanks,
Mark.
-----Original Message-----
From: Bret Pettichord [mailto:[EMAIL PROTECTED]
Sent: 28 October 2005 05:47
To: [email protected]
Subject: Re: [Wtr-general] My regexp is too greedy!!
At 04:19 PM 10/27/2005, Jeff Wood wrote:
>/[a-zA-Z0-9\._]*local.xml/.match('xpl.xml, demoUK.xml,
>met_local.xml,cfg.xml')[0]
>
>should work. just add any chars that are allowed in names to the []
>portion of the regex, you should be all good.
Or use:
/[^ ]*local.xml/
or
/\blocal.xml/
_____________________
Bret Pettichord
www.pettichord.com
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general