From: Robert Klemme Date: 2012-09-03T22:01:29+09:00 Subject: Re: Extract # Number from a string On Mon, Sep 3, 2012 at 2:27 PM, Brian Candler 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/