Regex Tester
CyrilEx is an online regex debugger, it allows you to test regular expression in PHP (PCRE), Python, Ruby, JavaScript, Java and MySQL. It helps you to test and debug regex online, you can visualize the matches when matching a string against a regex.
A regex visualizer allows to visualize your regex, it helps to understand it. This feature is useful for large regexes.
Cyrilex also allows you to generate a string example from a RegEx. This gives a pretty quick idea of a regex.
You can consult the regex Quick Start or see the full user guide to help you to use this regular expression tester.
User guide
- Step 0: Choose the regex engine: JavaScript, Ruby, Java or PCRE (PHP, Python).
- Step 1: Copy and paste or directly type your regular expression to test in the «Regular expression to test» field.
- Step 2: Select the flags you want in «Flags» section.
- Step 3: Copy and paste or directly type your test string in the «test string» field.
- As soon as you make a modification (regular expression, flags or test string):
- Step 4: An explanation is generated about of your regex. It uses regulex, it is a JavaScript Regular Expression Parser & Visualizer (Written in pure JavaScript).
- Step 5: A message indicates the number of correspondence
- Your regex is highlighted according to the syntax. It is a beta version, it can be wrong.
Generate a string from RegEx (Beta):
Clicks on «Generate a string from RegEx (Beta)» in order to generate a string that matches with the regex.Substitutions are not managed.
News: You can now test MySQL regex, select the «MySQL 8» engine.
About regular expression
A regular expression is a sequence of characters that define a search pattern. This pattern is used by string searching algorithms for find or replace text. It can be useful to validate an EMAIL address or an IP address.
Regex support is part of the standard library of many programming languages. Each programming language has its own regex engine, regular expression implementations vary slightly between languages.
Regex humor (Jamie Zawinski):
Some people, when confronted with a problem, think «I know, I’ll use regular expressions.» Now they have two problems.Regex Online
Cyrilex is an online regex checker, it allows to easily test and debug regex. This avoids wasting time writing the few lines of code needed to do the tests.
A regex visualizer and a regex generator help you to understand and debug your regexes.
This tool also allows you to share your regular expressions, this can be useful when you want to explain one of your regex problems (or its resolution) on a forum.
Regex Generator
Cyrilex also allows generating string from your Regex. By generating a string, this can help understand the Regex. This is particularly useful for fairly long regex.
This is also useful in the opposite direction. You can validate that your regex is correct by validating that the thong generated corresponds to the expected.
This tool does not manage all the features of the Regex.
The unavoidables
Some regex that can be useful (without warranty).
The last RFC is complex, there is no reliable solution, this regex should work more than 99% of the time (You must turn off case sensitivity).
The regex below allows to validate alphanumeric string. Be careful, \w authorizes the underscore character.
The regex below allows to validate MD5 string.
The regex below allows to validate IP v4.
Menu
Want to support RegExr? Consider disabling your ad-blocker for this domain. We’ll show a non-intrusive, dev-oriented ad in this area.
Expression
Create new tests with the ‘Add Test’ button. Click a test to edit the name, type, & text.
Tools
RegEx Engine
Expression Flags
Sign In
Sign in to persist favorites & patterns. Click the help icon above for info.
Any unsaved changes will be lost. Saved patterns & favorites will be migrated to your account.
Sign Out
You are currently signed in as — via —.
Character classes . any character except newline \w \d \s word, digit, whitespace \W \D \S not word, digit, whitespace [abc] any of a, b, or c [^abc] not a, b, or c [a-g] character between a & g Anchors ^abc$ start / end of the string \b \B word, not-word boundary Escaped characters \. \* \\ escaped special characters \t \n \r tab, linefeed, carriage return Groups & Lookaround (abc) capture group \1 backreference to group #1 (?:abc) non-capturing group (?=abc) positive lookahead (?!abc) negative lookahead Quantifiers & Alternation a* a+ a? 0 or more, 1 or more, 0 or 1 a a exactly five, two or more a between one & three a+? a? match as few as possible ab|cd match ab or cd Php regexp match online
You seem to be using an outdated version of your browser which is no longer supported by regexpr.com. It is highly recommended that you upgrade your browser. Sorry for the inconvenience.
-
- Save & Share
- Save Regex (CTRL+S)
- Fork Regex
- Add to Regex Library
- Flavor
- PCRE PCRE (PHP)
- JS JavaScript
- PY Python
- capture-group-regex capture group regex
- email-regex email regex
- email-validation-javascript email validation javascript
- end-of-line-regex end of line regex
- java-regex-match java regex match
- java-regex-replace java regex replace
- java-regex-tester java regex tester
- javascript-regex-match javascript regex match
- javascript-regex-tester javascript regex tester
- javascript-string-match javascript string match
- look ahead regex look ahead regex
- multiline regex multiline regex
- password validation in javascript password validation in javascript
- perl regex tester Perl regex tester
- phone number validator javascript phone number validator javascript
- php regex replace php regex replace
- powershell regex replace powershell regex replace
- python regex tester python regex tester
- python regex tester regex excel
- regex for alphanumeric regex for alphanumeric
- regex for alphanumeric regex for any character
- regex for date regex for date
- regex for digits regex for digits
- regex for ip address regex for ip address
- regex for number regex for number
- regex for password regex for password
- regex for phone number validator regex for phone number validator
- regex look behind regex look behind
- regex match regex match
- regex php regex php
- regex start of line regex replace
- regex tester regex tester
- regex tester regex url validation
- regex validation regex validation
- regex with new line regex with new line
- ruby regex tester ruby regex tester
- space-in-regex space in regex
- Tools
- Format Regex (requires free-spacing, /x)
- Code Generator
- Regex Debugger n/a Unit tests
- Filter flavors
- PCRE PCRE (PHP)
- JS JavaScript
- PY Python
Menu
Want to support RegExr? Consider disabling your ad-blocker for this domain. We’ll show a non-intrusive, dev-oriented ad in this area.
Expression
Create new tests with the ‘Add Test’ button. Click a test to edit the name, type, & text.
Tools
RegEx Engine
Expression Flags
Sign In
Sign in to persist favorites & patterns. Click the help icon above for info.
Any unsaved changes will be lost. Saved patterns & favorites will be migrated to your account.
Sign Out
You are currently signed in as — via —.
Character classes . any character except newline \w \d \s word, digit, whitespace \W \D \S not word, digit, whitespace [abc] any of a, b, or c [^abc] not a, b, or c [a-g] character between a & g Anchors ^abc$ start / end of the string \b \B word, not-word boundary Escaped characters \. \* \\ escaped special characters \t \n \r tab, linefeed, carriage return Groups & Lookaround (abc) capture group \1 backreference to group #1 (?:abc) non-capturing group (?=abc) positive lookahead (?!abc) negative lookahead Quantifiers & Alternation a* a+ a? 0 or more, 1 or more, 0 or 1 a a exactly five, two or more a between one & three a+? a? match as few as possible ab|cd match ab or cd preg_match — online function
Perform a regular expression match. Use /g option (global match) to use function like preg_match_all. This tool it’s a javascript function so result is generated by your browser and it’s not sent across internet .
Preg match cheatsheet
Pattern Description [a-z]+ Any string with small letters only [A-Z]+ Any string with uppercase letters only [abc] Single letter a, b or c [abc]$ Single letter a, b or c at the end of the line [abc] Single letter a, b or c occurring at least twice [abc] Single letter a, b or c occurring at least twice and a maximum 5 ^ Begining of the line $ End of the line \A Begining of string \z End of string . Any char \s Any whitespace char \S Any non whitespace char \d Any digit \D Any non-digit sign \w Any word character (letter, number, underscore) \W Any non-word character \b Boundary character. For string: «This island is beautiful» if we use regex: \bis\b despite three occurences of is, only one will be found. This and island occurences are skipped:
Th is is is beautiful.I’m create articles, tools so I can learn english and practice programming here. I hope some of this stuff can help you and save your time. If you have any suggestions, fell free to contact me.
Stay informed
Be the first to know new content and sign up for Scriptun newsletter.