[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: regex look behind

Zach Dennis

10/18/2003 5:44:00 PM

Please Note that (??=) was to be (?=).



-----Original Message-----
From: Zach Dennis [mailto:zdennis@mktec.com]
Sent: Saturday, October 18, 2003 12:53 PM
To: ruby-talk ML
Subject: regex look behind


I noticed that Ruby supports lookaheads (??=), but does ruby support look
behinds?

I can't get the syntax (?<=) to work. Is the syntax possibly different?

Thanks

Zach




2 Answers

Melanie Fielder

10/19/2003 1:15:00 AM

0

> From: Zach Dennis [mailto:zdennis@mktec.com]
> I noticed that Ruby supports lookaheads (??=), but does ruby support look
> behinds?
>
> I can't get the syntax (?<=) to work. Is the syntax possibly different?

AFAIK..no.

But the 'oniguruma' regex module for Ruby does support lookbehind.

Is there any paticular case where you need lookbehind ?

Can't you just use the pure-grouping operator (?:) around it ?

--
Simon Strandgaard


dhtapp

10/19/2003 2:10:00 AM

0


"Simon Strandgaard" <none> wrote in message
news:3f91e754$0$69913$edfadb0f@dread12.news.tele.dk...
> > From: Zach Dennis [mailto:zdennis@mktec.com]
> > I noticed that Ruby supports lookaheads (??=), but does ruby support
look
> > behinds?
> >
> > I can't get the syntax (?<=) to work. Is the syntax possibly different?
>
> AFAIK..no.

This was a useful exchange.

My past experience with regexes has been strictly "pragmatic", meaning I
would dink with a regex, when required, just enough to get the flipping
thing up and running predictably on a cross-sample of data. I've just
acquired (belatedly) Friedl's 2nd ed. "Mastering Regular Expressions", and
my pending mini-project is to work through the book with irb open, playing
as I go. Friedl lists a disheartening number of flavors in regex engines,
but I figure if I can get a handle on Ruby first and Java's newest regex
engine second, I'll be pretty well ahead of the game...hooray for
sabbaticals!

- dan