RegexBuddy – a solution to the Regular Expressions (Regex) nightmare

For the last few months I have been using RegexBuddy, software designed to help with Regular Expressions.

After using it to create and test more than one extremely complex regular expression, I thought it was time I gave RegexBuddy some ‘big ups’.

So what is so good about RegexBuddy,

Firstly, it allows you to create regular expressions using layman’s terms, “Non printable character”, “Match between zero and unlimited times”, “Create back-reference”, etc, no longer is there a need to remember the regular expression syntax.

Secondly, I can test my regular expression with extreme ease, I can show the full matched text and any matched groupings.

Thirdly, I can directly translate the regular expression to the programming language of choice, VB, PHP, JavaScript, etc, and not have to worry about the specifics of how to form a regular expression for that specific language.

I use RegexBuddy for PHP and JavaScript, I no longer need to ‘guess’ what the regular expression will be and constantly have to upload my code to the server to try it out.

Here’s an example expression I recently used in my WordPress plugin Slimbox2 Slideshow;

Convert Relative Links to Absolute Links with PHP Regex

Here is a quick post on how to find and replace relative links with absolute links using PHP Regular Expressions (regex).

$url = "http://myabsoluteurl.com/";
$ret = preg_replace('/((?:href|src) *= *[\'"](?!(http|ftp)))/i', "$1$url", $ret);