Regex – Testing

A regular expression is a special text string for describing a search pattern. You can think of regular expressions as wildcards on steroids.

But you can do much more with regular expressions. In a text editor like EditPad Pro or a specialized text processing tool like PowerGREP, you could use the regular expression \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}\b to search for an email address. Any email address, to be exact. A very similar regular expression can be used by a programmer to check if the user entered a properly formatted email address. In just one line of code, whether that code is written in Perl, PHP, Java, a .NET language or a multitude of other languages.

Since “regular expressions” is a mouthful, you will usually find the term abbreviated as “regex” or “regexp”.

regex

Test Your Regex with Regexer

Edit the Expression & Text with regexr.com to see matches.

Roll over matches or the expression for details. Undo mistakes with ctrl-z. Save Favorites & Share expressions with friends or the Community. Explore your results with Tools. A full Reference & Help is available in the Library, or watch the video Tutorial.

For example: ^[\S]{0,10}$ will match string with 10 characters. Just change the 10 to what ever number you want to match.