You are using a greedy regex there, and s/<body[^>]*>/$1$blah/gi; will probably grab more than you want.
s/<body[^>]*?>/$1$blah/si;This would be sufficient, and with the s modifier, it will account for <body> spanning multiple lines. I didn't use g, as I doubt you want to match <body> on a global scale.
Peace
In reply to Re^2: Regular Expressions
by dyer85
in thread Regular Expressions
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |