Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Regular Expression tricky newline problem

by GrandFather (Sage)
on Jan 02, 2006 at 22:37 UTC ( #520470=note: print w/ replies, xml ) Need Help??


in reply to Regular Expression tricky newline problem

Some sample code with "this is what I get", and "this is what I want" would help understand where you are having a problem. The following should be a good starting point, if not the stimulus for a D'oh moment :).

use strict; use warnings; my $lines = do {local $/; <DATA>}; my ($line3) = $lines =~ /Line 3 : (.*?)\n/; print ">$line3<"; __DATA__ Line 1 : Dit is de eerste regel Line 2 : Dit is de tweede regel Line 3 : Dit is de derde regel Line 4 : Dit is de vierde regel

Prints:

>Dit is de derde regel<

DWIM is Perl's answer to Gödel


Comment on Re: Regular Expression tricky newline problem
Select or Download Code
Reaped: Re^2: Regular Expression tricky newline problem
by NodeReaper (Curate) on Jan 03, 2006 at 04:00 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2015-07-05 13:28 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 (67 votes), past polls