Tools
English

Neogie Regex · Developers and SEO

Regex Tester Online: JavaScript Regular Expressions

Type a pattern and some text: matches and their groups are colored as you type.

Options (flags)

Waiting for a pattern.

Matches in the text


    

    

    

Replace

Examples to try

Cheat sheet

Click an item to insert it into the pattern or the replacement.

Everything happens in your browser: nothing you type is sent.

Building a regular expression

A regular expression describes a text pattern: a date, an address, a reference number. Type the pattern and paste a sample: every match is highlighted, groups are underlined in color, and the list gives their content and position. The “Replace” section shows the transformed text, using $1 or $<name> to reuse a group.

Reading groups

Parentheses create a group: the part they cover is captured separately. In a date, three groups isolate the year, the month and the day, which the replacement puts back in whatever order you want. Name them with (?<year>…) to keep track of them, or write (?:…) when you only want to group.

Which flavor?

The tool uses your browser’s engine, and therefore JavaScript syntax. Most patterns also work in PHP, Python, Java or a text editor, but there are differences: character classes, lookbehinds, flags. Check in the target language before going to production.

Protected against catastrophic patterns

Some patterns, such as (a+)+, try a huge number of combinations when the text does not match. The search therefore runs separately, in a process that the tool stops after two seconds: the page stays usable. On a server, such a pattern can block a service: fix it.

Frequently asked questions

How do I search for a dot or a parenthesis?

Put a backslash before the character: \. searches for a dot, \( for a parenthesis, \\ for the backslash itself.

Why is there only one match?

Without the g flag, the search stops at the first match. Check it to get them all.

How do I match as little text as possible?

Quantifiers are greedy: <.+> swallows everything, from the first < to the last >. Add a question mark, <.+?>, to stop at the first one.

Is my text sent anywhere?

No. The search runs on your device. Only the selected options are saved, never the pattern or the text.

Similar tools

Neogie SnippetSERP Snippet Preview ToolType a title and a description: the simulated result shows where they will be cut off. Neogie Base64Base64 Encoder and Decoder: Text, Files and JWTType on one side, the result appears on the other. Text, files and JWT tokens, with nothing uploaded. Neogie CRC32CRC-32 Calculator for Text and FilesThe checksum of a text as you type, or that of a file you want to compare. Neogie FileDiffCompare two files or folders: text and bytesDrop two files or two folders: differences appear at once, by line for text and by byte for everything else. Neogie BinaryBinary Translator: Text to Binary and BackType a message to see it in 0s and 1s, or paste binary to read it. Neogie HexText to Hex and Hex to Text ConverterType text to see its bytes, or paste hexadecimal to get the text back. Neogie PunycodePunycode Converter for Internationalized Domain Names (IDN)Turn a domain name with accents or other scripts into its “xn--” form, and back. Neogie Ascii85Ascii85, Z85 and Base85 Encoder and DecoderText or files to Base85 and back: five characters for every four bytes. Neogie Base32Base32 Encoder and DecoderText or files to Base32 and back, with the three most used alphabets. Neogie Base58Base58 and Base58Check Encoder and DecoderText or files to Base58 and back, with the Base58Check checksum if you want it. Neogie URLURL Encoder and Decoder (Percent-Encoding)Type on one side, the other fills in: addresses, parameters and form data, with every part spelled out. Neogie EntitiesHTML Entity Encoder and DecoderShow code or special characters without breaking the page: the result follows your typing. Neogie CSSCSS Formatter, Checker and MinifierPaste your style sheet: it is tidied up or compacted, and errors are reported. Neogie HTMLHTML Formatter, Checker and MinifierPaste your code: it is indented or compacted instantly, and structural errors are reported. Neogie JSONJSON Formatter and Validator OnlinePaste your JSON: it is checked and tidied up instantly, with the line and column of every error. Neogie SQLSQL Formatter Online: Indent and MinifyPaste a one-line query: it comes out split into clauses, ready to review. Neogie XMLXML Formatter and Validator OnlinePaste your XML: it is checked and indented instantly, with the line and column of the first error. Neogie MetaMeta Tag and Open Graph GeneratorFill in the fields: the preview and the code to paste into your page update instantly. Neogie RobotsRobots.txt Generator and TesterBuild the rules for search engine crawlers, then check which addresses they can visit. Neogie SitemapXML Sitemap Generator from a URL ListPaste your page URLs: your XML sitemap is ready to download.