Find every number
Input
Pattern: \d+ Flags: g Text: Room 12, floor 3, door 405
Output
12 3 405
Try a regular expression on your text, see every match and group highlighted, and stop slow patterns safely.
Everything happens on your device. What you type never leaves it.
A JavaScript regular expression, without the slashes.
The test text appears here with the matches highlighted.
This tool needs JavaScript to run
A regular expression, or regex, is a short pattern that describes text you want to find: every number, every email address, every line that starts with a word. Type a pattern, paste some text, and every match is highlighted in the text as you type. Below it, each match is listed with the groups it captured, by number and by name.
This tool uses the regular-expression flavour of your browser, which is JavaScript. Other languages such as Python, PHP or Java have small differences, so a pattern that works here may need a change there. The flags next to the pattern change how it matches: for example, "g" finds every match instead of only the first, and "i" ignores the difference between upper and lower case.
A badly written pattern can take a very long time on some text, and would freeze an ordinary page. Here the matching runs in a separate worker that is stopped after one second, so the page always stays usable and you are told that the pattern was too slow. Everything happens on your device; your text is never sent anywhere. The output is the matched text, one match per line, ready to copy or open with another tool.
Pattern: \d+ Flags: g Text: Room 12, floor 3, door 405
12 3 405
Pattern: (?<user>[\w.]+)@(?<host>[\w.]+) Text: write to [email protected]
Match 1: [email protected], group user: ana, group host: example.org
Pattern: (a+)+$ Text: aaaaaaaaaaaaaaaaaaaaaaaaaaaa!
This pattern took too long and was stopped.
The one built into your browser: JavaScript. Features such as named groups, lookbehind and Unicode property escapes work where your browser supports them. Patterns for other languages can behave differently.
Some patterns, such as nested repeats like (a+)+$, make the matcher try an enormous number of ways to fit the text when it does not match. The tool stops after one second so the page stays usable. Make the pattern more specific, or avoid repeating a group that contains a repeat.
Without the global flag (g), a pattern stops at its first match. Turn on "Global" to find every match.
No. The pattern and the text stay in your browser, and the matching runs in a worker on your own device.
A group inside an optional part of the pattern, such as (x)?, does not take part in a match that skips that part. It is listed as "did not match".