I am trying to build a regex which will match every line which doesn't contain the word "stylesheet
" in it, and has an "a href
" which has a value NOT starting with http
or www
.
This is how far I got, but it doesn't seem to do what I want:
grep -rin "href=\"\/*\/*\/|^((?!stylesheet).)*$" *.html
The goal is that this would be caught:
<a href="/api_supplier/">
<a href="/other-internal-link/abc/">
but this wouldn't:
<a href="http://github.com/">
<a href="www.github.com/index.html">
<a href="/other-internal-link/test/" rel="stylesheet">
The ultimate goal of mine is to append "index.html
" at the end of every internal link, so they would look like this:
<a href="/api_supplier/index.html">
<a href="/other-internal-link/abc/index.html">