Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Things you think you'll never use.

by Jenda (Abbot)
on Jan 21, 2005 at 23:14 UTC ( [id://424166]=note: print w/replies, xml ) Need Help??


in reply to Things you think you'll never use.

Why not something like this:

$re = qr{ \< (?: (?> [^<>]+ ) # Non-parens without backtracking | (??{ $re }) # Group with matching parens )* \> }x; $s = "B<I<U<bold underlined text>>> and B<bold text>"; 1 while $s =~ s{([BUI])<([^<>]*(?:$re[^<>]*)*)>}{<$1>$2</$1>}g; print $s,"\n";

Jenda
We'd like to help you learn to help yourself
Look around you, all you see are sympathetic eyes
Stroll around the grounds until you feel at home
   -- P. Simon in Mrs. Robinson

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://424166]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-23 15:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found