Reputation:
This Regex works great for converting URL's to lower case:
Search for...
(?<=(?i)href=")((?:<\?php(?:(?!\?>).)+\?>)?)((?:'[^']+')?)([^"]+)(?=")
Replace with...
\1\2\L\3
I think it might be a GREP; it works with TextWrangler but not Dreamweaver.
Anyway, I wondered if anyone knows how I can modify it so it ignores URL's that begin with http://. I only want to modify local links, which generally look like any of the following:
<a href="/World/Spain" title="Topics">Spain</a>
<a href="$G_URL/World/Spain" title="Spain">Spain</a>
<a href="'.$G_URL.'/World/Spain" title="Spain">Spain</a>
Upvotes: 0
Views: 59
Reputation: 59232
This worked for me:
(?<=(?i)href=")(?!http://)((?:<\?php(?:(?!\?>).)+\?>)?)((?:'[^']+')?)([^"]+)(?=")
You could even remove the ://
(?<=(?i)href=")(?!http)((?:<\?php(?:(?!\?>).)+\?>)?)((?:'[^']+')?)([^"]+)(?=")
Upvotes: 1
Reputation: 11116
(?<=(?i)href=")(?!http)((?:<\?php(?:(?!\?>).)+\?>)?)((?:'[^']+')?)([^"]+)(?=")
demo here :
Upvotes: 0