in reply to Regular Expression Help

Other monks may have wiser suggestions: if I were doing this, I'd strip all the codes before putting the text in the array, using something like
$text =~ s/<.+?>//g; push @array, $text;
Then when printing out,
for (@array) {print '<b>' . $_ . '</b>'}
... or whatever other formatting you might want to use.

Not sure this is what you want to do, but if it is, then this will do it. "Those people who like this kind of thing will find it the kind of thing they like", as Abraham Lincoln says.

§ George Sherston

Replies are listed 'Best First'.
Re: Re: Regular Expression Help
by tlhf (Scribe) on Sep 02, 2001 at 08:46 UTC
    In my own experience, something like s/<\/?\w+(.*?(\".*?\")?(\'.*?\')?)*?>//g is usually nicer for stripping tags, because often >s have a habit of slipping into automatically generated hrefs. And occasionally javascript event properties.

    I'm not definate if the above works perfectly, cause I just hacked it up in a couple of minutes, but it should be ok.