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

Re: Substitution Problem

by meraxes (Friar)
on Jul 10, 2004 at 06:54 UTC ( #373319=note: print w/ replies, xml ) Need Help??


in reply to Substitution Problem

The '.' metacharacter doesn't match newlines by default. You'll need to add the s pattern modifier to make it do that. You may want to add the i modifier as well to make it case-insensitive if you don't know that the HTML tags are all uppercase:

s{<FORM(.*?)/FORM>}{replacement text}is;

It may also be worth noting that if the HTML is not well formed you could end up removing a heck of a lot more than you intended using this regexp

Update: Whoops. Quite right davido. I assumed that everything was in a single scalar variable. Additionally, for a quickie list of regexp modifiers you can go to perlreref.


Comment on Re: Substitution Problem
Download Code
Re^2: Substitution Problem
by perldeveloper (Scribe) on Jul 10, 2004 at 15:54 UTC

      Ummmmm... no... perlreref is the regex quick ref. If it were a typo then th link wouldn't have worked. ;)

      Update: Um... still no. perlreref (perl regex reference faq), perlre (perl regex faq) and perlref (perl references and nested datastructures faq) are quite distinct.

        Actually, it might have worked even if mistyped, if it linked to another documentation page, like say perlref. Anyway, no harm done.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-12-23 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (134 votes), past polls