see - > i have the following text in a variable
var s =
"<html>
<head>
<style type="text/css" >
body{
background:url(/a.png);
}
</style>
<script src="2.js"></script>
<script src="1.js"></script>
</head>
<body >
{BODYCONTENT}
</body>
</html>";
Now i want to append some data immediately after closing of <style
> tag's >
.
Ex :
var mydata = "/n h1{a:b}/n";
So i want
<style>/n h1{a:b}/n
it is very easy if there is no other attribute in style tag,but sometime there may be some other attributes like type
,id
ex :
<style type="text/css" id="default_css_scope">
content
</style>
so that i cant use like this s.replace("<style>","<style>".mydata);
How can i do this with Regular Expression ?