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

Re: Re: Re: Re: Grabbing part of an HTML page

by graff (Chancellor)
on Mar 29, 2004 at 05:20 UTC ( [id://340512]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Grabbing part of an HTML page
in thread Grabbing part of an HTML page

Well, the current value of $/ has nothing to do with whether or not "." in a regex will match "\n" in a given string value; only the "s" modifier on the regex will allow "." to match "\n", no matter what $/ is. Try this out:
#!/usr/bin/perl $/ = undef; $_ = <DATA>; while ( /begin(.*?)end/g ) { print "\n--- found without 's': ---\n$1\n"; } while ( /begin(.*?)end/gs ) { print "\n--- found using 's': ---\n$1\n"; } __DATA__ blah begin foo bar baz end begin foo2 bar2 baz2 end

Replies are listed 'Best First'.
Re: ^4 Perl Monks - what am I doing wrong?
by cLive ;-) (Prior) on Mar 29, 2004 at 06:05 UTC
    D'oh - I just checked the file I tested on and it doeasn't contain a single new line.

    No wonder I was confused.

    cLive ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-24 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found