Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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";

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


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2015-07-29 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls