Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Reg Ex problems....

by seattlejohn (Deacon)
on Jan 09, 2003 at 07:24 UTC ( #225475=note: print w/replies, xml ) Need Help??


in reply to Reg Ex problems....

For #1: I think you want the trailing s modifier on any pattern you use, since the text you're matching against contains newlines that you want to treat as normal whitespace characters. Perhaps something like this would work:
m/\n([^\n]*)\nPANE/s

For #2: It sounds like your regex for identifying a URL might make some erroneous assumptions. Perhaps if you posted the specific code someone could offer more detailed assistance.

        $perlmonks{seattlejohn} = 'John Clyman';

Replies are listed 'Best First'.
Re: Re: Reg Ex problems....
by ihb (Deacon) on Jan 09, 2003 at 15:41 UTC
    The m and s modifiers are the everlasting objects of confusion for regexes. What the s modifier does is nothing but making . match *everything*, including newline. You're right that he probably wants to use s in his pattern, but in your pattern you've change the dot to [^\n] and now the s has no effect.

    Though, I'm one of those that propagate a wide use of s, simply because it's so often forgotten. So ++ for you for pointing it out. :)

    ihb

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2023-02-01 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (0 votes). Check out past polls.

    Notices?