Split

Ok guys im looking for something sexy to split this HTML (This HAS to be
done using split, nothing else)

hi, there, fred,

I would like to split them values into an array, Is there any chance
this can be done? Because im beginning to think there isn’t

Tia

Oh, i want all the values inside the tags, btw

Lee J. wrote:

Ok guys im looking for something sexy to split this HTML (This HAS to be
done using split, nothing else)

hi, there, fred,

I would like to split them values into an array, Is there any chance
this can be done? Because im beginning to think there isn’t

Tia

There you go —
f.split(/, |,/)

where f is your string.

Lee J. wrote:

Thanks, but i need to values inside the tags, So hello I need
hello…

Quick and dirty, but it works –

f.split(/, |,/).to_s.split(//).to_s.split(/</b>/)

could not figure out how to do this in one split

Arindam G. wrote:

Lee J. wrote:

Ok guys im looking for something sexy to split this HTML (This HAS to be
done using split, nothing else)

hi, there, fred,

I would like to split them values into an array, Is there any chance
this can be done? Because im beginning to think there isn’t

Tia

There you go —
f.split(/, |,/)

where f is your string.

Thanks, but i need to values inside the tags, So hello I need
hello…

On Mon, Sep 17, 2007 at 09:03:52AM +0900, Lee J. wrote:

Ok guys im looking for something sexy to split this HTML (This HAS to be
done using split, nothing else)

hi, there, fred,

I would like to split them values into an array, Is there any chance
this can be done? Because im beginning to think there isn’t

Oh, i want all the values inside the tags, btw

str.split(/|</b>,|</b>, /)

Tia
–Greg

This one is better–

f.split(/</b>, |</b>,/)

but it leaves you with one blank cell

On Sep 16, 7:03 pm, Lee J. [email protected] wrote:

Ok guys im looking for something sexy to split this HTML (This HAS to be
done using split, nothing else)

Why won’t your teacher let you use anything
other than split?

Does he know that you are getting your answers
from this forum?

Gregory S. wrote:

Oh, i want all the values inside the tags, btw

str.split(/|</b>,|</b>, /)

I thought, among other attrocities, that < was a reserved character for
regular expressions.

Not sure about the “has to be done using .split part”, if some of us
have
studied REXML and Hpricot so thoroughly… (-;

On Sep 16, 7:03 pm, Lee J. [email protected] wrote:

Ok guys im looking for something sexy to split this HTML (This HAS to be
done using split, nothing else)

hi, there, fred,

I would like to split them values into an array, Is there any chance
this can be done? Because im beginning to think there isn’t

hi, there, fred,”.scan(/(.*?)<.b>/).
flatten
==>[“hi”, “there”, “fred”]

hi, there, fred,”.
split(%r{|[, ]*(?:)?})
==>[“”, “hi”, “there”, “fred”]

William J. wrote:

On Sep 16, 7:03 pm, Lee J. [email protected] wrote:

Ok guys im looking for something sexy to split this HTML (This HAS to be
done using split, nothing else)

Why won’t your teacher let you use anything
other than split?

Does he know that you are getting your answers
from this forum?

Who said it was a teacher, This was for a challenge, And you’re not
providing an answers, Just a very helpful solution…

Thank you all