Marked - 1:11 pm on Jul 3, 2011 (gmt 0)
I spent like a day working on this. Basically what I am after is regex to find all the href URLs and <a> tags, and if it contains a certain part of a URL, then replace it. It definitely has to pick up both single and double quotes.
To illustrate, take the following example:
<a id='user_link' class='' href="http://mysite.com/forums_real_path/index.php?showuser=1" title='Your Profile'Username <span id='user_link_dd'></span></a>
I want to use regex to change 'forums_real_path' to just 'forums'. But it must be only in <a></a> tags.
Here's the code I was using, and it was working, but for some reason it didn't work on a bunch of new links:
Its kinda messy :/
If anyone could write a much better pattern for me, I'd be very grateful :)