Question: hi i'm trying to find and replace the link rel tags into a file with this command :

```
sed 's/(<link\b.+href=\")(?!http)([^\"]*)(\".*>)/someText/g'  www/file.html

```

but it doesn't work , could somebody help me please ? 
thank
one example that i want to do is : 

replace all this links tags : 

```
 <!-- Common app CSS -->
<link rel="stylesheet" type="text/css" href="less/med.ui.css" />
<link rel="stylesheet" type="text/css" href="less/timeline.css" />
<link rel="stylesheet" type="text/css" href="less/animate.min.css" />
<link rel="stylesheet" type="text/css" href="less/magic.min.css" />

<!-- Common UI CSS -->
<link rel="stylesheet" type="text/css" href="js/app/common/less/common.css" />
<link rel="stylesheet" type="text/css" href="less/sidebar.css" />

<!-- Specific App CSS -->
<link rel="stylesheet" type="text/css" href="js/app/timeline/less/timeline.css" />

```

with only this line : 

```
<link rel="stylesheet" type="text/css" href="js/app/globa/less/global.css" />

```

Answer: 
Since sed won't support lookarounds, i suggest you to use Perl instead.

```
perl -pe 's~(<link\b.+href=\")(?!http)([^\"]*)(\".*>)~\1js/app/globa/less/global.css" />~g' www/file.html

```

To save the changes made.

```
perl -i -pe 's~(<link\b.+href=\")(?!http)([^\"]*)(\".*>)~\1js/app/globa/less/global.css" />~g' www/file.html

```
doing this with sed

```
sed -i backup.bak '/<link\b.\+href=\"/{/href="[^"]*http/!{s#\(<link .\+href="\).*#\1js/app/globa/less/global.css" />#}}' www/file.html

```

EDIT:

or

```
sed -i backup.bak '/<link\b.\+href=\"/{
/href="[^"]*http/!{
s#\(<link .\+href="\).*#\1js/app/globa/less/global.css" />#
}
}'

```

`backup.bak` is a backup of the original file with a .bak extension