|
#1
|
|||
|
|||
|
I need a perl script to insert some text just after <body XXXX> open tag.
For Ex: <html><body bgcolor='#FFFFFF'></body></html> should result in <html><body bgcolor='#FFFFFF'>This is my text</body></html> Please note that the body open tag may differ at times. Please help me. |
|
#2
|
|||
|
|||
|
you would want to do something like this
Code:
$string ~= s/<body(.*?)>/<body$1>new stuff/; You might need to do something like /i; if body might be capitalized. You might need to do /s; if the body tag might not be on the same line. I would not suggest doing /g; because that is for replace every occurance in the string and body should only be found once.
__________________
md |
|
#3
|
|||
|
|||
|
It works GREAT. Thank you very much
|
|
#4
|
|||
|
|||
|
You are very welcome!
You might be interested in reading Useful Perl Scripts With Regular Expressions as it covers a lot of common tasks you would do with perl and regular expressions.
__________________
md |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|