With the Regular Expression Tester, you can enter regular expression and test quickly the way they match, substitute and transliterate text.

 

There is also an Explain box, that uses Jeff Pinyan's YAPE::Regex::Explain module to analyze the pattern of the regular expression. This module is included with OptiPerl's distribution.

 

Enter some text in the edit box and some input for processing in the left panel. Updating takes place automatically.

 

In the explain list box, moving through the tokens also highlights in the edit box the corresponding part of the regular expression that is explained.

 

Here are some examples that you can enter. After entering, type some corresponding text in the left panel to get the results.

 

/(ftp|http):\/\/([_a-z\d\-]+(\.[_a-z\d\-]+)+)(([_a-z\d\-\\\.\/]+[_a-z\d\-\\\/])+)*/

Check for URL addresses.

 

/\b([_a-z0-9-]+(\.[_a-z0-9-]+)*)@([_a-z0-9-]+(\.[_a-z0-9-]+)*)\.([a-z]{2,3})\b/

Very simple check for e-mail address, not recommended.

 

/(\d{3,4})[- ]?(\d{4})[- ]?(\d{4})[- ]?(\d{4})/

Credit card number check

 

/\b([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\b/

Check for IP addresses like 187.224.98.4 or 1.2.3.4, consist of four bytes separated by dots.

 

/\b\w{3,}a\b/

Word at least 4 letters long, ending with an a

 

/\A-?(?:(?=[1-9])\d*)\z/

Signed or unsigned number, not starting with 0.

 

tr/A-Z/a-z/

Convert all uppercase to lowercase

 

m/(\d{3})-(\d{3})-(\d{4})/

Check input if it is a valid U.S. telephone number.

 

s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg

This will unpack a URL Encoded String.

 

Important: You must include a starting and ending slash in the pattern you type. Entering a raw pattern does not work.

 

Regular Expression Tester is a program in it self! It is designed to quickly test implementations of regular expressions without endless rounds of editing-fixing-running.

 

 

 

Top  Previous  Next