Regex Tester

A free regular expression tester. Once done, try our free SDK for building Web3 apps fast.

npm i @tatumio/tatum

Match Information

Regex Cheat Sheet:

\d - Any digit
\w - Any word character
. - Any character except newline
* - Zero or more of the preceding element
+ - One or more of the preceding element
? - Zero or one of the preceding element
^ - Start of string
$ - End of string
(...) - Capture everything enclosed
[abc] - Any of the characters inside the brackets

How do you use a Regex tester?

Using a regex tester is a straightforward process:

Enter the Regular Expression: In the regex input field, type the regular expression you want to test. This typically looks like '/pattern/flags', where 'pattern' is your regex and 'flags' are optional characters that change how the search is performed. Common flags include g for global search, 'i' for case-insensitive search, and 'm' for multi-line search.

Enter the Test String: In another input field, provide the text you want to run the regex against. This is the text the regex will search through to find matches.

Execute the Test: Many regex testers will automatically start matching as soon as you type. Others might have a button you need to click to start the test.View Results: The regex tester will show you which parts of the test string matched your regex. It might highlight matches directly in the text or list them separately. If your regex uses capturing groups, it may also show you the captured groups.

Modify and Retest: If the regex doesn't match what you expected, adjust the pattern and test again. Regex testers often provide instant feedback, which helps in refining the expression.

Explanation/Description: A breakdown of your regex, explaining what each part does.

Match Information: Detailed information about each match, such as its position in the test string or its capture groups.

Here's a simple example using a regex tester:

Regex: \b\w+ly\b
Flags: g (if you want to find all matches)
Test String: "He was oddly fascinated by the strangely quickly hummingbird."
Expected Result: Matches "oddly", "strangely", and "quickly".

The regex tester should highlight these matches in the test string or list them for you, demonstrating the usefulness of such a tool in building and debugging regular expressions.

What is Regex?

Regular Expression (regex or regexp for short) is a sequence of characters that form a search pattern. It can be used for searching, matching, and manipulating strings. Regex is supported by most programming languages and tools that work with text, such as text editors and command-line tools.

Here's a brief overview of what regex can do:

Search: Find specific patterns of text within larger text documents. For instance, finding all instances of a specific word or phrase.

Validation: Check if a string meets a certain pattern, like an email address or a URL, which is commonly used in form validations.

Extraction: Pull out specific parts of a text. For example, extracting all the email addresses from a document.

Replacement: Substitute matched patterns with a new string, which is often used for data cleaning or simple text transformations.

Splitting: Divide text into an array of substrings based on a pattern, such as splitting a sentence into words.

Access Tatum Tools to Build on Blockchain

A powerful SDK, lightning-fast RPC nodes, faucets and a whole lot more for free.

Sign Up