Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://373319]
shmem is bored... sending limericks to the auth log

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2018-02-20 16:00 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (271 votes). Check out past polls.