http://qs321.pair.com?node_id=1028657

Lady_Aleena has asked for the wisdom of the Perl Monks concerning the following question:

I have become somewhat enamored of how text is parsed by POD for inline HTML elements, like B<a string> or I<a string>. I have gotten a regex to work for them, however I have not been able to figure out how to nest them such as I<B<a string>>. Here is what I have so far:

s/([A-Z]+)<(.+?)>/<\L$1\E>$2<\/\L$1\E>/g;

I have not gotten into adding ids, classes, styles, or other attributes yet.

Here is the list of tags I may use with this regex:

use strict; use warnings; while ( my $string = <DATA>) { $string =~ s/([A-Z]+)<(.+?)>/<\L$1\E>$2<\/\L$1\E>/g; print $string; } __DATA__ ABBR<a string> ACRONYM<a string> B<a string> BIG<a string> CITE<a string> CODE<a string> DFN<a string> EM<a string> I<a string> KBD<a string> SAMP<a string> SMALL<a string> SPAN<a string> STRONG<a string> SUB<a string> SUP<a string> TT<a string> VAR<a string> This is a B<string> which I want to I<parse> almost like EM<a POD>. CO +DE<Let's see if I can do it.>

Before you ask, yes, I looked for it (for about an hour) on CPAN to no avail.

Thanks in advance!

Have a cookie and a very nice day!
Lady Aleena