Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Perl regex

by Prof Vince (Friar)
on Sep 06, 2007 at 10:38 UTC ( #637377=note: print w/replies, xml ) Need Help??

in reply to Perl regex

You could use Text::Balanced for that :
use Text::Balanced qw/gen_extract_tagged/; my $text = q{hereiam[[one[[foo]]bar]]baz[[two]][[three]]wwhat}; my $parser = gen_extract_tagged "\Q[[", "\Q]]", qr/.*?(?<!\[\[)(?=\[\[)/, { bad => [ "\Q[[" ] }; while (($extracted, $remainder) = $parser->($text) and $remainder ne $text) { print "$extracted\n"; $text = $remainder; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://637377]
[choroba]: Most coffees? Depends on the country :-)
[choroba]: oh, you mean a cup with no water.
[Discipulus]: you are rigth, gory details but i remember from dunnowhere that concetrate caffein is more effective than brown water almost coffe..
[LanX]: prepared both kinds a 100 times and thinks the amount of grind code is about the same
Discipulus less effective i mean
[LanX]: (french press vs espresso cooker )
[LanX]: s/code/coffee/

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-01-16 10:57 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (148 votes). Check out past polls.