Regex Recipes
Browse regex recipes by task; each has a verified example, a counterexample and stated limits.
Verified Each verified example was run in JavaScript, Python re, PCRE2-8 and Go regexp, unless its card names other engines.
-
Extract order IDs of the form TX- plus five digits, keeping leading zeros.
Open in workbench — Extract Order IDs\bTX-\d{5}\b -
Extract log level names such as INFO, WARN and ERROR from log lines.
Open in workbench — Extract Log Levels\blevel=(INFO|WARN|ERROR)\b -
Find text shaped like YYYY-MM-DD; this checks the shape only, not calendar validity.
Open in workbench — Extract Date-shaped Text\b\d{4}-\d{2}-\d{2}\b -
Extract the text between square brackets on one line, including empty brackets.
Open in workbench — Extract Text Between Brackets\[([^\]\r\n]*)\] -
Extract key=value pairs whose key is an identifier and whose value has no spaces.
Open in workbench — Extract Key-value Fields\b([A-Za-z_][A-Za-z0-9_]*)=([^\s=]+) -
Match file names that end in .csv or .json; other extensions are left out on purpose.
Open in workbench — Match Selected File Extensions\.(?:csv|json)$ -
Match lowercase slugs made of letters, digits and single hyphens.
Open in workbench — Match Simple Slugs^[a-z0-9]+(?:-[a-z0-9]+)*$ -
Find version numbers with exactly three numeric parts, such as 3.14.2.
Open in workbench — Match Version Triplets\b\d+\.\d+\.\d+\b -
Find a word repeated immediately after itself; Go regexp is not offered because it has no backreferences.
\b([A-Za-z]+)\s+\1\bJavaScript · This browserPython re · Local WASMPCRE2-8 · Local WASMOpen in workbench — Find Repeated Words -
Extract simple double-quoted strings on one line; escaped quotes are not handled.
Open in workbench — Extract Simple Double-quoted Strings"([^"\\\r\n]*)" -
Find runs of spaces and tabs without matching line breaks.
Open in workbench — Find Horizontal Whitespace Runs[ \t]+ -
Split a simple comma list and trim the spaces around commas; quoted CSV is not supported.
Open in workbench — Split Simple Comma-delimited Text\s*,\s*
No page matches.