Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Regular expression...

by prasadbabu (Prior)
on Oct 08, 2010 at 06:27 UTC ( #864153=note: print w/replies, xml ) Need Help??


in reply to Regular expression...

Here is one way to do it.

$string =' some another lines =begin some lines some lines =end some another lines...'; while ($string =~ /(?:(?:^|\n)=begin)((?:(?!\n=end).)*)\n=end/gs){ print "$1\n"; } output: ======= some lines some lines
Updated: included '\n' before =end.

Prasad

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://864153]
help
Chatterbox?
[davido]: A tool as pretentious as Test::Perl::Critic ought not fail to install because one of its dependencies failed to pull in List::MoreUtils.
[davido]: ...and Clone.pm

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2017-04-25 16:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (458 votes). Check out past polls.