Works pretty well in capturing the full URL when using this in a search (like in Sublime Text 2).
(https?|ftps?)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/?
The following will capture the URL in a SQL dump including escaped quotation marks.
http://www.yourwebsite.org/calculator/degrees/sociology
(https?|ftps?)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/calculator/degrees/([^\\"]+)
http://www.yourwebsite.org/degrees/$3/
http://www.yourwebsite.org/degrees/sociology/
This will find all hrefs that do not contain a trailing slash. NOTE: it will detect links in your <head>
and ones that end in .html
that purposfully do not have a trailing slash, so becareful performing a find/replace.
href="http://www.yourwebsite.org/calculator/degrees/financial"
href="(\S)+[^/]"
Convert from http://old.yourwebsite.org/whatever/
to http://new.yourwebsite.com/whatever/
EXPLAINED:
preg_replace('|(https?://)old(new\.yourwebsite\.)org|i', '$1$2com', $content);
#RewriteRule ^calculator/degrees(?:/([\w-]+?)(?:-in.+)?)?/?$ /degrees/$1/ [L,R=301]