On Fri, Nov 9, 2012 at 2:14 PM, <sto.mar / web.de> 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/