[Memphis.pm] Regexes, finding a <BR> tag and throwing into arrays.
Brock Sides
philarete at mindspring.com
Tue Apr 17 07:13:09 CDT 2001
* Alaric Ravenhall <alaricravenhall at hotmail.com> [010417 06:52]:
> Hi all.
> Can anyone tell me of an easy way to take a string of text, parsing by a
> <BR> tag at the end each word, and put it into an array?
> I will have something similar to this:
>
> Ravenhall<BR>Nemesis<BR>Thulsa<BR>Imoen<BR>Tweedledum<BR>Tweedledee<BR>
>
> I want to INCLUDE the <BR> tag in the array thusly:
>
>
> @names =
> {"Ravenhall<BR>","Nemesis<BR>","Thulsa<BR>","Imoen<BR>","Tweedledum<BR>","Tweedledum<BR>"}
foreach ($string =~ m/(.+?<br>)/gi) {
push @names, $_;
}
I'm sure there's a more elegant way, but this
@names = $string =~ m/(.+?<br>/gi/;
doesn't seem to create the list context for m//g. I'm not sure why.
--
Brock Sides
philarete at mindspring.com
The original plan [for GNOME] was to aim to make a desktop as good as
the Macintosh, and we should not lower our ambition by making one
merely as good as Windows. -- RMS
----------------------------------------------------------------------------
To unsubscribe, please send email to majordomo at pm.org
with 'unsubscribe memphis-pm-list' in the body of the message.
----------------------------------------------------------------------------
More information about the Memphis-pm
mailing list