Over a million developers have joined DZone.

Preview Live Regex

DZone 's Guide to

Preview Live Regex

· Web Dev Zone ·
Free Resource

Regular expressions are a great way to find a pattern of text to do a global replace or to store the variables of the pattern. The problem comes when you have quite a complicated pattern that you are trying to match. You might need to make lots of changes to your code for it to work correctly. This continued code changes and re-testing your code can be very time consuming, you need a better way of testing your regular expressions.

If you are creating a htaccess file to match URLs and redirect else where then you need a good way of testing the pattern.

Here is a really good tool for testing regular expressions, it's called PHP Live Regex and allows you to test matching your regex with a number of different strings. If you are using the preg_match() function then this tool will even provide you with an array of matches you will get from this regular expression.

Once you have finished your regex to match the strings you want, you can save this code by creating a URL for this regex code. Which makes this tool really useful for code sharing, if you have created a regex and want to share this with other developers you can do so with a simple link.

PHP Live Regex

Try it out.

PHP Live Regex


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}