Over a million developers have joined DZone.
Platinum Partner

Preview Live Regex

· Web Dev Zone

The Web Dev Zone is brought to you in partnership with Mendix.  Discover how IT departments looking for ways to keep up with demand for business apps has caused a new breed of developers to surface - the Rapid Application Developer.

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

The Web Dev Zone is brought to you in partnership with Mendix.  Learn more about The Essentials of Digital Innovation and how it needs to be at the heart of every organization.


Published at DZone with permission of Paul Underwood , DZone MVB .

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}