Regex and cron

Regex Tester and Explainer

Write a regular expression, watch every match light up as you type, and read what each part of the pattern does in plain English.

  • Free foreverNo trial, no paywall, no usage limits.
  • No sign-upOpen the page and start. We never ask for an email to use a tool.
  • PrivateEverything runs in your browser. Your input is never uploaded or stored on our servers.
  • Works offlineOnce the page has loaded, the tool keeps working without a connection.

Regular expression

JavaScript syntax, run by your browser's own engine in a background worker. Press / anywhere to jump here.
Show cheat sheet: click any token to insert itCopy patternCopy a share link (pattern, flags and test text)
Find every match instead of stopping at the first. Needed for matchAll() and for replacing all occurrences.Case-insensitive: /abc/i also matches "ABC" and "aBc".^ and $ match at the start and end of every line, not just the whole string. Use it to test one value per line.Lets . match line breaks too. Without it, . stops at \n and \r.Treats the pattern as Unicode code points: enables \p{…} property escapes and \u{…}, makes emoji count as one character, and rejects sloppy escapes.Only matches starting exactly at lastIndex (position 0 here), never further along. Useful for tokenizers that consume input piece by piece.Records the start and end index of every capture group (match.indices). The tester always shows group positions, so this only changes your code.The upgraded unicode mode (ES2024): set operations like [\p{L}--[a-z]] and [A&&B], string properties like \p{RGI_Emoji}. Cannot be combined with u.
3 matches3 matches · 3 groups

Test string

Matches are highlighted as you type, in alternating colors. Click inside a match (or hover its row below) to color its capture groups.
3 matchesClear test string

Explanation

Every part of the pattern in plain English. Hover a row to highlight that part of the pattern.
Copy explanation

Loading the explainer…

Every match with its position and capture groups.Preview a replacement with $1, $<name> and $& references, then copy the result.Copy a ready-to-run snippet for JavaScript, Python, Go, C#, PHP or Dart.

Matches

Named groups are shown by name. undefined means the group did not take part in that match.
Copy matches as JSONDownload matches.csv
#MatchPositionGroups
12026-10-128–18
  • year2026
  • month10
  • day12
22026-09-3037–47
  • year2026
  • month09
  • day30
32027-01-05102–112
  • year2027
  • month01
  • day05

Need a secure web app built around this? Talk to our team

Quick answer

A regex tester runs a regular expression against sample text and shows every match as you type. In Playxoft's free Regex Tester, enter a pattern between the slashes, switch on flags such as g (global) or i (ignore case), and paste your text: matches are highlighted, capture groups are listed, and each part of the pattern is explained in plain English. Patterns run in your browser's JavaScript engine inside a background worker, so nothing is uploaded.

  • Live match highlighting
  • Plain-English explanation
  • Named capture groups
  • Replace preview
  • Code export in 6 languages
  • Backtracking protection
  • Shareable links
  • Clickable cheat sheet

How to use the Regex Tester

  1. 1Type your pattern into Regular expression, between the slashes. Syntax errors are underlined at their exact position, with a hint on how to fix them.
  2. 2Turn on flags with the chips below the pattern: g finds every match, i ignores case and m makes ^ and $ work on each line.
  3. 3Paste text into Test string. Matches are highlighted as you type; click inside one to color its capture groups.
  4. 4Read Explanation to see what every token does, and hover a row to highlight that part of the pattern.
  5. 5Switch to Replace to preview $1 or $<name> substitutions, or to Code to copy the pattern for JavaScript, Python, Go, C#, PHP or Dart.
  6. 6Click the link icon to copy a share link with your pattern, flags and test text.

What is a regular expression?

A regular expression (regex) is a pattern that describes a set of strings. Engines use it to find, validate, split and replace text: checking that an input looks like an email address, pulling every date out of a log file, or renaming variables across a codebase. Most characters match themselves; a handful of metacharacters carry the power:

TokenMeaningExample
.Any character except a line breakc.t matches cat, cot, c7t
\d \w \sDigit, word character, whitespace\d{4} matches 2026
[abc] [^abc]One of, or none of, these characters[aeiou] matches any vowel
^ $Start and end of the string (or line, with m)^Hello
\bWord boundary\bcat\b skips concatenate
* + ?Zero or more, one or more, optionalcolou?r
{n,m}Between n and m times\d{2,4}
(…) (?:…)Capturing and non-capturing group(\d+)px
(?<name>…)Named capture group(?<year>\d{4})

The pipe means "or": cat|dog matches either word. To match a metacharacter literally, escape it with a backslash, as in \. or \(. Not sure what a pattern you found online does? Paste it above and the Explanation panel breaks it down token by token. For ready-made, tested patterns, browse the regex pattern library.

What do the regex flags g, i, m, s, u, y, d and v do?

Flags change how the whole pattern behaves. JavaScript supports eight:

FlagNameWhat it does
gglobalFind every match, not just the first. Required by matchAll() and replaceAll()
iignoreCase/abc/i also matches ABC
mmultiline^ and $ match at every line break, not only at the ends of the string
sdotAll. also matches line breaks
uunicodeCode-point matching, \p{…} property escapes and strict syntax
ystickyMatch only at lastIndex, never further along
dhasIndicesRecord start and end positions of every group in match.indices
vunicodeSetsThe successor to u: set operations like [\p{L}--[a-z]] and emoji properties

The most common bug is a missing g: without it, replace() only changes the first occurrence. The second most common is m: if you test one value per line, ^ and $ need it to anchor each line. The v flag (ES2024) cannot be combined with u.

What is the difference between greedy and lazy quantifiers?

Quantifiers are greedy by default: *, +, ? and {n,m} take as much text as they can, then give characters back one at a time if the rest of the pattern fails. Adding ? makes them lazy: they take as little as possible and only grow when they must.

Against the text <b>bold</b>:

  • <.+> (greedy) matches the whole string <b>bold</b>, because .+ runs to the end and backs off only to the last >.
  • <.+?> (lazy) matches <b> and then </b>, stopping at the first > each time.

Often the best fix is neither: <[^>]+> says exactly what is allowed between the brackets, needs no backtracking, and reads more clearly. Lazy quantifiers do not make a pattern faster by themselves; precise character classes do.

How do lookahead and lookbehind work?

Lookarounds check what is next to the current position without including it in the match. They are zero-width: the engine looks, then carries on from where it was.

SyntaxNameSucceeds when the text…
(?=…)Lookaheadafter this point matches
(?!…)Negative lookaheadafter this point does not match
(?<=…)Lookbehindbefore this point matches
(?<!…)Negative lookbehindbefore this point does not match

\d+(?=px) finds the 12 in 12px but not in 12em. (?<=\$)\d+ finds the 42 in $42 without the dollar sign. Several lookaheads at the start of a pattern check independent rules, which is how password policies are usually written: ^(?=.*\d)(?=.*[A-Z]).{12,}$.

JavaScript allows lookbehinds of any length. Python's built-in re requires fixed-width lookbehinds, and Go's RE2 has no lookarounds at all; the Code tab warns you when a pattern will not port.

What is catastrophic backtracking and how do I avoid it?

Most regex engines, including JavaScript's, are backtracking engines: when part of a pattern fails, they go back and try another way to match the earlier parts. If a pattern offers exponentially many ways to split the same text, a failing match tries them all. ^(a+)+$ on thirty a's followed by a ! takes over a billion steps, and the page freezes. On a server, the same mistake is a denial-of-service hole known as ReDoS.

This tester runs every pattern in a Web Worker and stops it after 300 milliseconds, so a runaway pattern shows a warning instead of locking your browser. The Explanation panel also flags risky shapes before you hit them. To avoid the problem:

  1. No nested quantifiers on the same text: (a+)+, (\w+\s?)* and (.*)* are the classic offenders.
  2. Make alternatives mutually exclusive: (a|ab)* can become (ab?)*.
  3. Prefer specific classes to .*: "[^"]*" instead of ".*".
  4. Anchor and bound what you can: ^…$, and limits like {1,64} on untrusted input.
  5. Cap input length before matching, and on servers use an engine or option with a guarantee: Go's RE2 runs in linear time, and .NET supports match timeouts.

How do regex engines differ between JavaScript, PCRE, Python, Go and .NET?

The core syntax is shared, but the details that break ported patterns are not:

FeatureJavaScriptPCRE (PHP)Python reGo (RE2).NET
LookaheadYesYesYesNoYes
LookbehindAny lengthFixed or bounded lengthFixed widthNoAny length
BackreferencesYesYesYesNoYes
Named group(?<n>…)(?<n>…)(?P<n>…)(?P<n>…), or (?<n>…) from Go 1.22(?<n>…)
Atomic groupsNoYesYes (3.11+)Not neededYes
\p{…} propertiesWith u or vYes (u needed beyond Latin-1)No (regex module)YesCategories and blocks
\d matches0–9 only0–9 by defaultAny Unicode digit0–9 onlyAny Unicode digit
$ before a final newlineNoYes (unless D)YesNoYes
Linear-time guaranteeNoNoNoYesOptional (NonBacktracking)

The Code tab handles the mechanical part for you: it rewrites named groups for Python and Go, turns $ into \Z or \z where the engines disagree, spells \d and \w as ASCII ranges for Python and .NET, converts escapes like \u{1F600}, maps flags to each language's options, and warns about constructs the target cannot run. To go further, test the translated pattern in that language's own tooling before you ship it.

Frequently asked questions

JavaScript (ECMAScript), executed by your browser's own regex engine, so results match what your code will do in that browser or in Node.js. The Code tab translates the pattern for Python, Go, C#, PHP and Dart and lists the differences.
The g (global) flag is off. Without it, JavaScript stops at the first match and replace() only changes the first occurrence. Turn on g to find and replace every match.
Engines differ. Python names groups with (?P<name>...) and only allows fixed-width lookbehinds, and Go's RE2 has no lookarounds or backreferences at all. Open the Code tab for a translated pattern and a list of anything that will not port.
The pattern took longer than 300 milliseconds, so the tester stopped it. That almost always means nested or overlapping quantifiers, such as (a+)+ or (\w|\d)*, that make the engine try exponentially many ways to match. The explanation panel points to the part responsible.
No. Matching runs in a Web Worker in your browser and nothing you type is uploaded. The page address keeps your pattern so you can bookmark or share it; a shared link carries its contents like any URL, so do not share links that contain secrets.
Escape it with a backslash: \. matches a period, \( a parenthesis and \/ a slash. Inside square brackets most characters lose their special meaning, so [.] also matches a literal dot.

Last updated by the Playxoft engineering team.

From the engineers who built this tool

Building something bigger than a quick fix?

Auth, payments, dashboards and security are where web apps get hard. We have shipped them many times. Share your idea and we will map out a realistic plan and estimate, free and with no obligation.

More free tools

See all tools

Cron Expression Generator

New

Build and explain cron schedules, see the next runs in any time zone, copy platform snippets.

Open tool

SQL Formatter

Beautify or minify SQL in 12 dialects, with keyword case, indent and line:column errors.

Open tool

cURL to Python Converter

New

Convert cURL commands into Python requests or httpx code with params, json, files and auth.

Open tool

cURL to Fetch Converter

New

Turn any cURL command into JavaScript fetch() code with headers, JSON, forms and auth.

Open tool

cURL to Axios Converter

New

Convert cURL commands into an Axios request config with params, data, auth and timeouts.

Open tool

SQL to Prisma Converter

Turn SQL DDL into a schema.prisma with native types, relations and enums.

Open tool