From: Robert Klemme Date: 2012-11-09T22:25:44+09:00 Subject: Re: Ruby script to process html --f46d042a0d5580f04204ce0fe3e4 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Nov 9, 2012 at 2:14 PM, 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> ' Test'[%r{(.*?)}, 1] => "Test" irb(main):002:0> ' Test'[%r{(?<=)(.*?)(?=)}] => "Test" Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ --f46d042a0d5580f04204ce0fe3e4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On Fri, N= ov 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. :-) =A0In 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 :-)
=A0
:-)
=A0
<= /div>
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>=A0 &= #39;=A0 <tr>Test</tr>'[%r{<tr>(.*?)</tr>}, 1] =3D> "Test"
irb(main):002:0>=A0 '=A0 <tr>Test&= lt;/tr>'[%r{(?<=3D<tr>)(.*?)(?=3D</tr>)}]
=3D> = "Test"

Kind regards

robert

-- =
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractice= s.com/
--f46d042a0d5580f04204ce0fe3e4--