Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Things you think you'll never use.

by Jenda (Abbot)
on Jan 21, 2005 at 23:14 UTC ( #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";

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

Comment on Re: Things you think you'll never use.
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2015-11-26 18:18 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (705 votes), past polls