
poly4life
Novice
Apr 1, 2011, 7:24 AM
Post #1 of 2
(1262 views)
|
|
Trouble formulating substitute regular expression, need some help, please
|
Can't Post
|
|
Hello, I am having great difficulty putting together this regular expression and I am asking for help. I have a file like this:
<title>Example</title> <!-- This is a comment for this page. Make sure to fill this area with appropriate information. --> <style type="text/css"> I'm trying to make it looks like this:
<title>Example</title> <!-- This is a comment for this page. Make sure to fill this area with appropriate information. --> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <style type="text/css"> Here's the substitution I'm using that is not working:
$contents =~ s|(<title>.*</title>)(\S<!--[\s\S]*-->\S)(<style)|$1$2<meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n$3|i; Thank you.
|