On Mon, Sep 3, 2012 at 2:27 PM, Brian Candler <[email protected]> wrote:
> Robert Klemme wrote in post #1074406:

>> irb(main):009:0> arr.map {|s| s[/(?<=#)\d+/]}
>
> ...although the positive lookbehind assertion (?<=...) is a somewhat
> esoteric feature of regexps.

I am not sure I agree on "esoteric".  If you had said it is a more
recent feature, then I'd readily agree.  I can name off the top of my
head at least three mainstream programming languages which support it
(Java, Ruby >= 1.9 and Perl).

> You can avoid it using the form
> String#[regexp, fixnum] to get just the captured value that you are
> interested in.

Right.

> There's certainly More Than One Way To Do It :-)

If anything, that is true. :-)

Cheers

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to