Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Regular Expressions

by davidrw (Prior)
on Jun 19, 2005 at 22:52 UTC ( [id://468203]=note: print w/replies, xml ) Need Help??


in reply to Re: Regular Expressions
in thread Regular Expressions

See what i just posted below.. that won't work if the string is something like (and presumably it is, otherwise it would just be $string .= $newContent;):
my $string =<<EOS; <body leftmargin=0 bgcolor="red" > blah and stuff </body> EOS

Replies are listed 'Best First'.
Re^3: Regular Expressions
by apt_get (Acolyte) on Jun 19, 2005 at 23:26 UTC
    Yes, I understand the limitations. Will be more careful in the future. Apologies to the OP, and thanks to the monks...
Re^3: Regular Expressions
by ww (Archbishop) on Jun 20, 2005 at 15:19 UTC
    OT: excellent regex point, but OP's html fu could stand some help: leftmargin is/was IE specific (some other browsers honor it; some don't) and arguement '0' should be double quoted.

    And re specific example, space between "red" and > is also naughty... (but I can see how the string could -- real world -- include '\n's, I'm skeptical that spreading it out over multiple lines enhances readability.

    <UPDATE ++ davidrw, below, re use of JS or TT! Again proving adage that one should put brain in gear before opening mouth. Thanks!
      good points.. I almost commented on the double quotes, too.. and y, css can handle the margin stuff..

      As for \n's inside the <body ... > opening tag, here's a couple trivial examples that illustrate the types of cases that i've done that for readability (basically for javascript, and for Template Toolkit stuff):
      <body bgcolor="red" foo="bar" onLoad=" if( x = do_something() ) { do_other_js() ; } else { blah( +); }" > # TT syntax: <body bgcolor="red" foo="bar" [% IF use_js %] onLoad=" ... " [% END %] >

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (8)
As of 2024-04-18 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found