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
| [reply] [d/l] [select] |
Yes, I understand the limitations. Will be more careful in the future. Apologies to the OP, and thanks to the monks...
| [reply] |
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!
| [reply] |
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 %]
>
| [reply] [d/l] [select] |