On Fri, Nov 9, 2012 at 2:14 PM, <[email protected]> wrote:
> Am 09.11.2012 09:08, schrieb Robert Klemme:
>
> I find processing tag structures with line oriented tools pretty uncool.
>> :-) In fact it's also error prone like you state yourself:
>>
>
> Robert, that's exactly what I wanted to convey to the OP,
> thanks for repeating :-)
>
:-)
> But he also asked how to extract values from a string,
> and - for other problems, rather not for this one -
> that knowledge might actually be useful.
>
Right, although in that case I would use slightly less arcane features:
irb(main):001:0> ' <tr>Test</tr>'[%r{<tr>(.*?)</tr>}, 1]
=> "Test"
irb(main):002:0> ' <tr>Test</tr>'[%r{(?<=<tr>)(.*?)(?=</tr>)}]
=> "Test"
Kind regards
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