Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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.

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://373319]
help
Chatterbox?
Discipulus some monks here around are flammable.. or well they interact like a porcupine and an airbaloon
[beech]: yes, farting is an apt description for a lot of the irrelevant hot gas

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2017-01-20 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (174 votes). Check out past polls.