Testing Regular Expression Match Patterns

Regular expression started in Perl language. But it is now used everywhere: text editors, programming languages, and software testing tools. Regular expression is powerful, but hard to learn. This page allows you to learn and test regular expression with your own strings, match patterns, sub patterns, and modifiers.

What is a regular expression?

A regular expression is a string of normal and meta characters that can be evaluated as a match pattern. The best reference guide on regular expression is the Perl manual called "perlre". You can easily find and download a copy of "perlre" on the Web.

For example, "/^(http:\/\/)?[^\/]+/i" is a regular expression that represents a pattern to match the base URL of any Web page URL.

How to test regular expression

To help you learn and test regular expression match patterns, FYIcenter.com has designed this online testing page using the PHP preg_match() funtion:

  • preg_match(pattern, subject, matches) - Returns the number of times the pattern matches in the subject.

All you need to do is to enter the pattern string and the subject string in the form below and click the Start button. Remember that the pattern string must include "/" as delimiters.



Popup Windows Tutorials

20 tutorials on different ways to create and test popup windows created in JavaScript: Page unload popups, Pop re-open on close, ...

200+ PHP Script Tutorials

Each tutorial answers one commonly asked PHP programming question with a short, but precise and clear PHP script.