Jump to content

User:DemonDays64/Bot/Regex Example

From Wikipedia, the free encyclopedia

((?<=(?<!\?)url ?= ?)|(?<=\[)|(?<=<ref>))(http:\/\/)?(www\.)?latimes\.com

Will find and edit the italicized section if the previous text is there:

  • <ref>http://www.example.com</ref>
  • url= http://example.com
  • url =http://example.com
  • [http://example.com
  • url=example.com
  • url=www.example.com
  • url=http://www.example.com

This thing will only affect the http:// or http://www. or the www. and not the url= (or variation) or the square bracket, through the magic of Regex lookbehinds.


Negative for:

  • https://www.example.com and all other things containing https://www. or https:// before the url
  • ?url=http://www.example.com

Doesn't work in Firefox, so bot will run in Chrome when approved instead :o