REGex TESTER

ver. 1.5.3 by Venimus (venimus@gmail.com)


Regex tester http://www.regextester.com

As promised Regex Tester 2.0 Alpha is released to public - main engine is rewritten, new functionalities yet to come.




Dialect:JavaScript Preg Ereg
Flags: i: g: m: s:
Type regex:    Del
Test on Text:

Replace with:    Del

Result:


Most Wanted Regular Expressions (PCRE)
JavaScript/VBscript Pattern Syntax Refference
PCRE (PHP preg*/Perl) Pattern Syntax Refference
POSIX (PHP ereg*/JAVA) Pattern Syntax Refference
Regular expressions in Wikipedia


View all news. Click to bookmark or add as a Opera Hotpanel.

25.08.2009: (ver. 2.0) Regex Tester 2.0 alpha is released.
21.06.2007: (ver. 1.5.3) Fixed bug in PCRE diealect (preg) not displaying \ and + signs correctly. Fixed the date pattern in examples (would not match 20-th).
02.08.2006: (ver. 1.5.2) Resizers fixed. Added rss 2.0 feeds .
28.07.2006: (ver. 1.5.1) Due to an increased interest, site moved to a separate domain www.RegExTester.com. Please, update your bookmarks. Due to a common demand input field sizes increased, added resize. Site design and new features pending, stay in touch.
11.07.2006: (ver. 1.5.1) Bugfixes: Should work better on FireFox. That browser does not enumerate properly the matches in JS mode. In addition it may not refresh properly sometimes, so you may press Ctrl or Shift in the edit fields to force refresh.
28.06.2006: (ver. 1.5) Major Update: Added list of matches (PCRE preg* dialect gives most information). Resize of the "test" field - drag the "*". Bugfixes: Now "replace" dropdown works. Hotpanel link corrected. "New lines" displayed in the result.
09.06.2006: (ver. 1.4.1) Minor Update: Bugfixes.
04.06.2005: (ver. 1.4) Major Update: Added POSIX (PHP ereg*) and PCRE (PHP preg*) pattern syntax dialects.
Misc: Site hosting moved (sorry for causing any troubles). License updated to version 2.5 (no new limitations).
29.04.2005: (ver. 1.3) Added history (dropdown) of typed patterns. Click the dropdown arrow button to save the current input and view the old ones. Click from the list to use another. Click del to remove the selected line from the history list.
27.08.2004: (ver. 1.2) Major bug fixes. No crashes on invalid patterns. Added support for pattern flags (i,g,m). Some interface changes.
22.10.2003: (ver. 1.1) Minor interface changes to match the recommendations for HotPanels.
20.10.2003: (ver. 1.1) Some changes for compatibility with Opera 7.x.
18.10.2003: (ver. 1.0) First public release. IE 5.5 Compatible only.
This site is a regular expression tester. You can use it to build proper regular expressions. The sources are totaly free.
This site allows you to do a regex test, i.e. it utilizes JavaScript (AJAX) to instantly validate regular expressions (regex), by searching and replacing strings in a text based on the regular expression. The result is live, it is updated instantly while you type, without any submission of forms and extra clicking, thus allowing fast and easy edit of regular expressions, having a constant clue what they exactly do.

This tool is constantly improved to stay the most advanced since it has been the first to utilize AJAX technology for testing Perl (PCRE) and PHP (POSIX) regular expressions. Currently this site is able to test JavaScript, PCRE and POSIX dialects. JavaScript dialect is used in ECMAScript, JScript and VBScript programming languages. PCRE dialect is mainly used in Perl, PHP, Apache's .htaccess, grep and most software. POSIX is mainly used in PHP and UNIX programming languages. Despite there may be some differences in most cases all regular expressions regardless the dialect are compatible.

Introduction

Validating user input is the bane of every software developer's existence. Having one module that addresses all the user inputs greatly reduces the number of validating errors. Writing a single routine that does all the validation would be very difficult and tedious. The Regular expressions tool, however, can be used to validate all user inputs. It can make your code faster, more efficient, and less error prone. Regular expressions are a powerful tool for searching and processing text, and even in its simplest form, can make many complex tasks easy.

Regular Expressions: What are They?

Regular expressions are a tiny, highly specialized programming language. They used to only be familiar to Unix users. Text editors like vi allowed regular expressions-formatted searches. Finally, Microsoft decided to give the same power to us and implemented it in Interdev. Most likely people haven't noticed it when they are using Find in Interdev.

When Microsoft started creating scripting languages for the Windows platform, only JScript contained regular expressions, leaving VBScript alone in the dark. That changed with version 5 of the VBScript engine. To ensure that Visual Basic (VB) developers can use regular expressions, the VBScript regular expressions engine has been implemented as a COM object. This makes them much more powerful, since they can be called from various sources outside of VBScript, such as Visual Basic or C.

Regular expressions provide tools for developing complex pattern-matching and textual search-and-replace algorithms. Any PHP, Perl, egrep, awk, or sed developer will tell you that regular expressions are one of the most powerful utilities available for manipulating text and data. By creating patterns to match specific strings, a developer has total control over searching, extracting, or replacing data. In short, to master regular expressions is to master your data.

A regular expression is a series of characters that define a pattern. The pattern is then compared to a target string to see whether there are any matches to the pattern in the target string.

Patterns
Regular expressions are almost another language by itself. A pattern defines the criteria to search for within a string. Regular expressions can be as simple as plain text, or use a unique language consisting of special characters and modifiers to build these patterns.

Regex Examples (PCRE)
Regular expression examples for decimals input

Positive Integers --- ^\d+$
Negative Integers --- ^-\d+$
Integer --- ^-{0,1}\d+$
Positive Number --- ^\d*\.{0,1}\d+$
Negative Number --- ^-\d*\.{0,1}\d+$
Positive Number or Negative Number - ^-{0,1}\d*\.{0,1}\d+$
Phone number --- ^\+?[\d\s]{3,}$
Phone with code --- ^\+?[\d\s]+\(?[\d\s]{10,}$
Year 1900-2099 --- ^(19|20)[\d]{2,2}$
Date (dd mm yyyy, d/m/yyyy, etc.) --- ^([1-9]|0[1-9]|[12][0-9]|3[01])\D([1-9]|0[1-9]|1[012])\D(19[0-9][0-9]|20[0-9][0-9])$
IP v4 --- ^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]){3}$

Regular expression examples for Alphabetic input

Personal Name --- ^[\w\.\']{2,}([\s][\w\.\']{2,})+$
Username --- ^[\w\d\_\.]{4,}$
Password at least 6 symbols --- ^.{6,}$
Password or empty input --- ^.{6,}$|^$
email --- ^[\_]*([a-z0-9]+(\.|\_*)?)+@([a-z][a-z0-9\-]+(\.|\-*\.))+[a-z]{2,6}$
domain --- ^([a-z][a-z0-9\-]+(\.|\-*\.))+[a-z]{2,6}$

Other regular expressions
Match no input --- ^$
Match blank input --- ^[\s\t]*$
Match New line --- [\r\n]|$

Please, report any bugs to the author.

regex in action: www.subconvert.com Subtitle convertor (.srt, .sub, .psb, .ssa, .txt)
Legal note:

Creative Commons LicenseThis site including any source codes, unless other specified, is licensed (2003-2012) by I. Badinov under a Creative Commons License 2.5. Any external materials referred by this page are licensed by their respective owners.
About the author:
Ivaylo Badinov is a leading conceptual programmer in the wellknown Bulgarian software company KoralSoft, specialised in producing online and offline language tools as EuroDict, as well as web development, SEO and corporate solutions.