The Un-Official Proxomitron Forum

Full Version: [solved] Negative regex / subdomain
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can somebody please help me with a regex that matches links to all Wikipedia domains but en.wikipedia.org? For example, I want to filter:
Code:
http://it.wikipedia.org/wiki/Lala
and
Code:
http://es.wikipedia.org/wiki/Lala
but not
Code:
http://en.wikipedia.org/wiki/Lala

I've tried this, but it didn't work:
Code:
/<a href="http://(?!en)\.wikipedia\.org/.*?".*?</a>/
I've managed to do what I wanted by creating two filters. The first one adds an extra attribute to tags that contain links to en.wikipedia.org, and the second one matches all remaining Wikipedia links. Smile!

Code:
search="/<a href=\"http://en\\.wikipedia\\.org/"
replace=<<END
<a alt="WIN" href="http://en\.wikipedia\.org/
END
Code:
search=<<END
/<a href="http://..\.wikipedia\.org/
END

PS: I may have stripped something out while editing my code to post it here, but the full thing works. :p
Great you were able to figure it out. I had a suggestion about whether or not you needed to escape the slashes, but apparently that was wrong. Good luck!
Reference URL's