# regexguide.com — full content for LLMs > Free in-browser regex explainer and pattern library. This file contains the full text of the glossary, the FAQ, and all 300 patterns for grounding. Source: https://regexguide.com/ ## Regex Glossary (116 terms) ### Alternation (|) The "or" operator in a regex. cat|dog matches "cat" or "dog". Alternation has the lowest precedence of any operator, so ^cat|dog$ means "starts with cat" OR "ends with dog" — wrap it in a group, ^(cat|dog)$, to constrain it. ### Anchor A token that matches a position in the text rather than a character. The common anchors are ^ (start), $ (end), and \b (word boundary). Anchors are zero-width — they consume no characters. ### Assertion A construct that tests whether a condition holds at the current position without consuming characters. Anchors and lookarounds are both assertions; they succeed or fail based on what surrounds the position. ### Atomic group A group written (?>...) that, once matched, will not give back (backtrack into) its characters. Atomic groups are a key tool for preventing catastrophic backtracking. Not supported in JavaScript. ### Backreference A reference to text a capturing group already matched, written \1, \2, etc. (\w+)\s+\1 matches a doubled word because \1 must equal whatever group 1 captured. ### Backslash (\\) The escape character in regex. It turns a metacharacter into a literal (\. matches a dot) and turns some letters into special tokens (\d, \b). A literal backslash is written \\. ### Backtracking The engine's process of retrying alternative ways to match after a path fails — undoing a greedy quantifier or trying the next alternation branch. Excessive backtracking is the root of most regex performance problems. ### Bounded quantifier ({n,m}) A quantifier specifying a repetition count: {3} (exactly 3), {2,5} (2 to 5), {2,} (2 or more). Also called an interval or bracketed quantifier. ### Boundary A position between two characters that a boundary assertion like \b can match. A word boundary sits between a word character (\w) and a non-word character. ### Capturing group Parentheses ( ... ) that both group a subpattern and save the matched text into a numbered slot for later use in backreferences or replacements. See also non-capturing group. ### Caret (^) Outside a character class, ^ anchors to the start of the string (or the start of each line with the multiline flag). As the first character inside a class, [^...], it negates the class. ### Case folding The engine's normalization of letter case so a case-insensitive match treats "A" and "a" as equal. Unicode case folding also handles pairs like "ß"/"ss" in some engines. ### Case-insensitive flag (i) A flag that makes letters match regardless of case, so /hello/i matches "HELLO". Enable it inline with (?i) in most flavors. ### Catastrophic backtracking A pathological slowdown where nested or overlapping quantifiers (like (a+)+$) force the engine to explore exponentially many match paths on a failing input. The mechanism behind most ReDoS vulnerabilities. ### Character class ([ ]) A set of characters in square brackets, any one of which matches at a position. [aeiou] matches one vowel; ranges like [a-z] and shorthands like [\d\s] are allowed inside. ### Character range A span of characters inside a class written with a hyphen, such as [a-z] or [0-9]. The endpoints are compared by code point, so order matters — [z-a] is an error. ### Code point A single Unicode scalar value, the unit that \u escapes and Unicode-aware matching operate on. With the u flag, a regex matches whole code points rather than UTF-16 code units. ### Compiled pattern A regex that the engine has parsed and turned into an internal matching program. Reusing a compiled pattern (e.g. re.compile in Python) avoids recompiling it on every call. ### Conditional pattern A construct that matches one subpattern or another depending on whether a group participated, written (?(1)yes|no). Supported in PCRE, Python (3.11+), and .NET, but not JavaScript. ### Control character escape (\cX) An escape for ASCII control characters, where \cA is Ctrl-A (0x01), \cM is carriage return, and so on. Rarely needed outside low-level text protocols. ### Delimiter The characters that mark where a pattern begins and ends in languages that use them, usually forward slashes — /pattern/flags in JavaScript, or preg_match('/.../', ...) in PHP. ### Deterministic finite automaton (DFA) An engine model that tracks all possible matches simultaneously in linear time and never backtracks, at the cost of not supporting backreferences or lookaround. RE2 and most POSIX tools use a DFA-style approach. ### Digit shorthand (\d) Matches a single digit. In ASCII mode that is [0-9]; with Unicode enabled it can also match digits from other scripts. Its negation \D matches any non-digit. ### DotAll flag (s) A flag (also called single-line mode) that lets the dot . match newline characters, so . matches truly any character. Enable it inline with (?s). ### Dot / wildcard (.) Matches any single character except a line terminator by default. Escape it as \. to match a literal period, or enable the dotAll flag to make it match newlines too. ### Dollar sign ($) Anchors a match to the end of the string, or (with the multiline flag) the end of each line. In some flavors $ also matches just before a trailing newline; use \z for a strict end-of-string. ### Empty match A match of zero length, produced by patterns like a* or a lone lookahead. Engines advance past a zero-length match to avoid looping forever when matching globally. ### Escape sequence A backslash followed by a character that has special meaning, such as \n (newline), \t (tab), \d (digit), or \. (literal dot). ### Escaping Placing a backslash before a metacharacter so it is treated literally. Escaping ., *, ( and friends is how you match those symbols as ordinary text. ### Extended mode (x) A flag (also called verbose or comment mode) that makes the engine ignore unescaped whitespace and treat # as a line comment inside the pattern, so complex regexes can be laid out and annotated across multiple lines. ### Finite automaton The abstract "machine" a regex is compiled into for matching. The two families are the NFA (backtracking, feature-rich) and the DFA (linear-time, restricted). ### Flag / modifier A setting that changes how a pattern matches — case-insensitivity (i), global (g), multiline (m), dotAll (s), Unicode (u), sticky (y), and extended (x) are the common ones. ### Flavor A specific regex dialect with its own syntax and feature set — JavaScript, PCRE, Python re, Java, .NET, Go (RE2), and Ruby (Onigmo) all differ in lookbehind, named-group syntax, and Unicode handling. See our flavor converter. ### Global flag (g) A flag that makes a pattern find every match rather than stopping at the first, so str.match(/\d+/g) returns all numbers and replace substitutes every occurrence. ### Grapheme cluster A "user-perceived character" that may consist of several code points, such as an emoji with a skin-tone modifier. Standard regex operates on code points, so matching whole graphemes usually needs a dedicated construct like \X in PCRE. ### Greedy quantifier A quantifier that matches as many repetitions as possible, then backtracks if needed. *, +, ?, and {n,m} are greedy by default — <.*> grabs everything between the first "<" and the last ">". ### Group Parentheses that bundle part of a pattern so a quantifier or alternation can apply to the whole unit. Groups may be capturing ( ), non-capturing (?: ), named, or atomic. ### Hexadecimal escape (\xHH) Matches a character by its two-digit hex code, e.g. \x41 for "A". Longer forms like \x{1F600} (PCRE) address higher code points. ### Inline modifier A flag switched on within the pattern itself, such as (?i) for case-insensitivity from that point on, or the scoped form (?i:...) that applies only inside the group. ### Kleene star (*) The * quantifier, meaning "zero or more" of the preceding token. Named after Stephen Kleene; a* matches "", "a", "aa", and so on. ### Lazy quantifier A quantifier followed by ? that matches as few repetitions as possible, expanding only when forced. <.*?> stops at the first ">". Also called reluctant or non-greedy. ### Line terminator A character that ends a line — line feed \n, carriage return \r, and, in Unicode-aware engines, the separators U+2028/U+2029. It governs where . stops and where ^/$ match in multiline mode. ### Literal A character that matches itself with no special meaning, like the letters in cat. Metacharacters become literals when escaped. ### Lookahead A zero-width assertion (?=...) (positive) or (?!...) (negative) that tests what follows the current position without consuming it. Often stacked for rules like a strong-password check. ### Lookaround The umbrella term for lookahead and lookbehind — zero-width assertions that check the text around a position without including it in the match. ### Lookbehind A zero-width assertion (?<=...) (positive) or (? (JavaScript/.NET) or (?P=name) (Python). ### Named capturing group A capturing group given a label, written (?\d{4}) (or (?P...) in Python), so you can read it by name — far clearer than counting numbered groups. ### Negated character class ([^ ]) A class beginning with ^ that matches any single character NOT listed, so [^0-9] matches one non-digit. ### Nondeterministic finite automaton (NFA) The backtracking engine model used by most mainstream flavors (PCRE, Java, .NET, JavaScript, Python). It supports rich features like backreferences and lookaround but can suffer catastrophic backtracking. ### Non-capturing group A group written (?:...) that applies a quantifier or alternation without saving the match, keeping capture-group numbers clean. (?:ab)+ repeats "ab" without storing it. ### Octal escape A character specified by its octal code, historically written \0, \012, or \o{...}. Ambiguous with backreferences in some flavors, so it is used sparingly. ### Optional (?) The ? quantifier, meaning "zero or one" of the preceding token. colou?r matches both "color" and "colour". ### Overlapping matches Matches that share characters. Standard engines consume characters as they go and so return non-overlapping matches; finding overlaps requires lookahead tricks or repeated searching from shifted positions. ### Pattern The regular expression itself — the sequence of literals, metacharacters, and constructs that describes the set of strings to match. ### Pipe (|) The symbol used for alternation. See Alternation. ### Plus (+) The quantifier meaning "one or more" of the preceding token. \d+ matches a run of at least one digit. ### POSIX character class A named class usable inside a bracket expression, such as [[:alpha:]], [[:digit:]], or [[:space:]]. Common in grep, sed, and PostgreSQL; not available in JavaScript. ### Possessive quantifier A quantifier followed by + (as in a*+ or \d++) that grabs its maximum and never gives characters back, like an atomic group. Useful for performance; unsupported in JavaScript and Python's re before 3.11. ### Precompilation Compiling a pattern once and reusing it, rather than recompiling on each match. Improves performance in hot loops and is available in most languages via a compile/pattern object. ### Quantifier A construct specifying how many times the preceding token may repeat — *, +, ?, and {n,m}. Each has greedy, lazy, and (in some flavors) possessive modes. ### Question mark (?) Depending on position, the optional quantifier (a?), the laziness modifier (a+?), or the opener of an extension group ((?:...), (?=...)). ### Raw string A source-code string in which backslashes are taken literally, so regex escapes survive intact — Python's r"\d+", C#'s @"\d+", Go's backtick strings. Avoids doubling every backslash. ### RE2 Google's linear-time regex engine that guarantees no catastrophic backtracking by forbidding backreferences and lookaround. It powers Go's regexp, Google Sheets, and Search Console. ### Recursion A pattern that refers to itself to match nested structures, written (?R) or (?1) in PCRE. It lets regex match balanced constructs that a non-recursive pattern cannot. ### ReDoS Regular-expression Denial of Service — an attack that feeds crafted input to a backtracking-prone pattern to exhaust CPU. Mitigated by avoiding nested quantifiers, adding timeouts, or using an RE2-style engine. ### Regex engine The software component that compiles a pattern and runs it against input. Its design (NFA vs DFA) and flavor determine which features and performance guarantees you get. ### Regular expression A compact, formal description of a text pattern used to search, validate, extract, and replace strings. Paste one into our explainer for a plain-English breakdown. ### Replacement string The text substituted for each match in a replace operation. It can reference captured groups with $1/${name} (JavaScript, .NET, PHP) or \1/\g (Python). ### Sticky flag (y) A JavaScript flag that anchors each match attempt to lastIndex, so matching succeeds only if it begins exactly there. Useful for tokenizers that scan a string piece by piece. ### Subpattern Any self-contained part of a larger pattern, usually a group. The term is common in PCRE documentation, where subpatterns can be numbered, named, or called as subroutines. ### Subroutine call A reuse of another group's subpattern by number or name, written (?1) or (?&name) in PCRE. Unlike a backreference, it re-runs the subpattern instead of matching the earlier text again. ### Substitution Replacing matched text with a replacement string — the "replace" half of search-and-replace. Global substitution replaces every match. ### Unicode flag (u) A flag that makes a pattern treat the input as Unicode code points (not UTF-16 units), enabling \u{...}, correct handling of astral characters, and \p{...} property escapes in JavaScript. ### Unicode property escape (\p{...}) Matches characters by Unicode property or category, such as \p{L} (any letter), \p{N} (any number), or \p{Emoji}. Negate with \P{...}. Requires the u flag in JavaScript. ### Verbose mode See Extended mode — the whitespace-ignoring, comment-friendly layout mode enabled by the x flag. ### Whitespace shorthand (\s) Matches a single whitespace character: space, tab \t, newline \n, carriage return \r, form feed, or vertical tab. Its negation \S matches any non-whitespace. ### Word boundary (\b) A zero-width assertion matching the position between a word character and a non-word character. \bcat\b matches "cat" as a whole word but not the "cat" in "category". Its negation is \B. ### Word character shorthand (\w) Matches a single "word character": letters, digits, and underscore — [A-Za-z0-9_] in ASCII mode. Its negation \W matches any non-word character. ### Zero-width assertion A construct that matches a position, consuming no characters — anchors (^, $, \b) and lookarounds all qualify. Several can stack at the same position. ### Anchored match A match required to begin at a specific position — the start of the string, or (with JavaScript's sticky flag) at lastIndex. Contrast with an unanchored search that scans forward for the first match. ### Assertion failure The outcome when a zero-width test (anchor or lookaround) does not hold at the current position, causing the engine to backtrack or abandon that path. ### Bracket expression The POSIX name for a character class — the [...] construct, including ranges and POSIX classes like [[:digit:]]. ### Capture index The number assigned to a capturing group, counted by the position of its opening parenthesis from left to right, starting at 1 (group 0 being the whole match). ### Comment group An inert group (?#...) whose contents are ignored by the engine, used to annotate a pattern in flavors that support it. ### Dot-matches-newline The behavior enabled by the dotAll (s) flag, in which . also matches line terminators. Off by default in nearly every flavor. ### End-of-string anchor (\z) A strict end-of-input assertion. Unlike $ or \Z, \z matches only at the very end and never before a trailing newline. Available in Python, Ruby, PCRE, and Java. ### Global match Finding all non-overlapping matches in the input, driven by the global flag or an "find all"/iterator API such as re.findall or matchAll. ### Greediness The property of a quantifier that determines how much it matches before backtracking — greedy (maximum), lazy (minimum), or possessive (maximum, no give-back). ### Interval quantifier Another name for the bounded quantifier {n,m} that specifies an explicit repetition count or range. ### Match position The character offset in the input where a match (or a captured group) begins or ends, exposed as index/start()/end() depending on the language. ### Modifier group A scoped inline-flag group such as (?i:abc) that applies flags only to the enclosed subpattern, or (?-i:abc) to turn them off. ### Nested group A group contained within another group. Nesting affects capture numbering (outer opens first) and, when combined with quantifiers, is a common source of catastrophic backtracking. ### Non-greedy A synonym for lazy — a quantifier that matches as little as possible. See Lazy quantifier. ### Previous-match anchor (\G) An assertion matching at the end of the previous match (or the start of the search on the first attempt), used to tokenize contiguous input without gaps. Supported in PCRE, Java, .NET, and Ruby. ### Reluctant quantifier Java's term for a lazy quantifier — one suffixed with ? that matches the fewest repetitions. ### Search vs match A distinction in some APIs: "match" anchors at the start of the string (Python's re.match) while "search" scans forward for the first match anywhere (re.search). ### Start-of-string anchor (\A) An assertion matching only at the very beginning of the input, unaffected by the multiline flag — unlike ^, which can match after internal newlines in multiline mode. ### Tempered greedy token A pattern like (?:(?!END).)* that matches greedily but stops before a forbidden sequence, used to match "everything up to but not including" a delimiter without lazy matching. ### Token A single meaningful unit of a pattern — one literal, metacharacter, class, group, or quantified construct. Our explainer breaks a regex down token by token. ### Unrolling the loop A hand-optimization that rewrites an alternation-inside-a-quantifier into a form the engine matches without excessive backtracking, improving performance on large inputs. ### Vertical bar Another name for the pipe |, the alternation operator. ### Zero-length match A match that consumes no input, such as the result of a* against "b" or a bare anchor. Global matching steps forward one position after one to avoid an infinite loop. ### Astral character A Unicode character beyond the Basic Multilingual Plane (code point above U+FFFF), such as many emoji. Matching these correctly in JavaScript requires the u flag so they are treated as single code points. ### Balancing group A .NET-specific construct, (?...), that pushes and pops a capture stack to match balanced, nested structures like parentheses — .NET's answer to recursion. ### Control verb A PCRE backtracking-control construct such as (*SKIP), (*PRUNE), (*FAIL), or (*ATOMIC) that gives fine-grained control over how the engine backtracks. ### Possessive dot-star The construct .*+ (or an atomic (?>.*)) that consumes the rest of the line and refuses to give any of it back — a performance guard that also changes matching semantics. ### Boundary assertion Any zero-width test tied to a position boundary — \b, \B, ^, $, \A, \z, \G. They match "between" characters rather than characters themselves. ### Quantifier target The single token or group a quantifier applies to — always the item immediately to its left. ab+ repeats only "b"; (ab)+ repeats "ab". ### Alternation precedence The rule that | binds more loosely than concatenation or quantifiers, so it splits the largest surrounding scope unless parentheses narrow it. ### Unicode mode The matching behavior in which a pattern operates on Unicode code points and honors Unicode properties and case folding, enabled by the u flag in JavaScript or on by default in Python 3. ### Anchor tag An informal name for the start/end anchors ^ and $ that pin a pattern to the beginning or end of the input. ## Frequently Asked Questions ### What is a regular expression (regex)? A regular expression is a compact string of symbols that describes a search pattern. Instead of matching one fixed word, a regex can match a whole family of strings — for example \d{3}-\d{4} matches any seven-digit, phone-style number. Regex engines are built into almost every programming language and text editor and are used to search, validate, extract, and replace text. Paste any pattern into our explainer for a plain-English breakdown. ### How to test a regex pattern online? Paste your pattern and a sample string into an online tester. Our explainer shows what each token means, while sites like regex101 focus on live match testing. Testing against your own real sample data is the only reliable way to confirm a pattern before you ship it. ### How to escape special characters in regex? Put a backslash before any metacharacter — . ^ $ * + ? ( ) [ ] { } | \ / — to match it literally. For example, a literal dot is \. and a literal opening paren is \(. To escape a dynamic string in JavaScript, use str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'). ### How to do a case-insensitive regex search? Add the case-insensitive flag. In JavaScript that is the i flag — /hello/i matches "Hello", "HELLO", and "hello". In Python pass re.IGNORECASE, in most editors tick the "Aa" toggle, and in PCRE-style engines use the inline modifier (?i). ### What does \d mean in regex? \d matches any single digit, 0–9 (in Unicode mode it can also match digits from other scripts). Its opposite, \D, matches any non-digit. So \d{4} matches exactly four digits, like a year. ### What does \w match in regular expressions? \w matches a single "word character": the letters A–Z and a–z, the digits 0–9, and the underscore _. \W is its inverse (any non-word character). Note that it does not include hyphens, spaces, or most punctuation. ### What does \s mean in regex? \s matches any whitespace character — a space, tab \t, newline \n, carriage return \r, form feed, or vertical tab. \S matches any non-whitespace character. Use \s+ to match a run of whitespace. ### What does \b (word boundary) mean in regex? \b is a zero-width word boundary — it matches the position between a word character (\w) and a non-word character, not an actual character. \bcat\b matches "cat" as a whole word but not the "cat" inside "category". ### What does the dot . match in regex? The dot . matches any single character except a line break. To also match newlines, enable the dotAll flag (s in JavaScript and PCRE) or use a class like [\s\S]. To match a literal period, escape it as \.. ### What does \A and \Z mean in regex flavors? \A anchors to the very start of the input and \Z (or \z) to the very end, regardless of the multiline flag — unlike ^ and $, which can match at internal line breaks in multiline mode. They exist in Python, Java, PCRE, and Ruby, but not in JavaScript, which relies on ^/$ instead. ### What is a character class [] in regex? Square brackets define a character class — a set of characters, any one of which can match at that position. [aeiou] matches one vowel, [a-z] matches one lowercase letter via a range, and a leading caret negates the set, so [^0-9] matches any character that is not a digit. ### How to match any character except newline? Use the dot ., which matches any character except a line break by default. To match truly any character including newlines, use a class like [\s\S] or turn on the dotAll (s) flag. ### How to match whitespace characters in regex? Use \s for a single whitespace character or \s+ for one or more in a row. To match only spaces and tabs but not newlines, use an explicit class such as [ \t]. ### How to match alphanumeric characters only? Use ^[A-Za-z0-9]+$ to match a string made up entirely of letters and digits. Add the underscore with ^\w+$, or allow Unicode letters with ^[\p{L}\p{N}]+$ and the u flag. ### How to match numbers only using regex? Use ^\d+$ to match a string of one or more digits and nothing else. For an optional sign and decimals, use ^-?\d+(\.\d+)?$. ### What do ^ and $ anchor tags do in regex? ^ anchors a match to the start of the string and $ to the end — both are zero-width, matching a position rather than a character. Wrapping a pattern in ^...$ forces it to match the entire string, which is essential for validation. With the multiline flag they anchor to the start and end of each line. ### What is the difference between * and + quantifiers? * means "zero or more" of the preceding token, so it can match nothing; + means "one or more", requiring at least one. For example a* matches the empty string, while a+ needs at least one "a". Add ? (as in a+?) to make either one lazy. ### What is the difference between greedy and lazy matching? By default quantifiers are greedy — they match as much as possible and then backtrack. Adding ? makes them lazy, matching as little as possible. On "", <.*> grabs the whole string, but <.*?> stops at the first ">". A lazy quantifier is the usual fix for "my pattern matches too much". ### How to match optional characters using regex? Follow the optional part with ?, which means "zero or one". colou?r matches both "color" and "colour", and https? makes the "s" optional. Group several optional characters with parentheses, e.g. (ing)?. ### How to match exactly N number of characters? Use a fixed quantifier: \d{4} matches exactly four digits. {2,4} matches two to four, {3,} matches three or more, and {0,2} matches up to two. ### How to match a range of numbers in regex? Regex matches text, not numeric value, so you build a range digit by digit. For 0–255 (an IP octet) use 25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d. For a small fixed range a class works: [1-9]|1[0-2] matches 1–12. ### What is a non-capturing group (?:)? (?:...) groups part of a pattern — so you can apply a quantifier or alternation to it — without saving the match into a numbered capture group. Use it when you need grouping but not the captured text, which keeps your group numbers and backreferences clean: (?:ab)+ repeats "ab" without storing it. ### What are named capturing groups in regex? Name a group with (?\d{4}) and refer to it by name instead of a number — far more readable in long patterns. Read it via match.groups.year in JavaScript or m.group('year') in Python; .NET uses the same (?) syntax. ### What is a backreference in regular expressions? A backreference matches the same text a previous group captured. (\w+)\s+\1 finds a doubled word because \1 must equal whatever group 1 captured — ideal for spotting duplicate words. Named backreferences use \k. ### What is a regex lookahead assertion? A lookahead (?=...) asserts that what follows matches, without consuming it. \d+(?= dollars) matches the number in "100 dollars" but not the word. Because lookaheads are zero-width, several are often stacked for password rules like "must contain a digit". ### What is a regex lookbehind assertion? A lookbehind (?<=...) asserts that what precedes the current position matches, without including it in the result. (?<=\$)\d+ matches the digits after a "$". Lookbehind is supported in modern JavaScript, Python, .NET, PCRE, and Java, though some older engines restrict it to fixed length. ### How to use negative lookahead (?!)? (?!...) asserts that what follows does NOT match. foo(?!bar) matches "foo" only when it is not followed by "bar". It is the standard way to exclude cases, e.g. ^(?!.*--).+$ rejects any string containing "--". ### How to match multiple patterns using OR |? The pipe | means "or", trying each alternative in turn: cat|dog|fish matches any one of the three. Wrap the alternatives in a group to limit their scope — ^(cat|dog)$ — otherwise the | splits the entire pattern in two. ### How to match strings that do not start with a specific character? Use a negative lookahead right after the start anchor: ^(?!#).* matches any line that does not begin with "#". To reject a whole starting word, use ^(?!error).*. ### What is the global flag (/g) in regex? The global flag g makes a pattern find every match rather than stopping at the first. In JavaScript, str.match(/\d+/g) returns all numbers and a /g pattern in replace substitutes every occurrence. Without it, you only get the first match. ### What is the multiline flag (/m) in regex? The multiline flag m changes ^ and $ so they match at the start and end of each line, not only the whole string. It is essential when you process multi-line text line by line. ### What is the dotAll flag (/s) in regex? The dotAll flag s lets the dot . match newline characters too, so . matches literally any character. It is handy for capturing a block of text that spans several lines. ### How to validate email using regex? A practical pattern is ^[^\s@]+@[^\s@]+\.[^\s@]+$ — some non-space, non-@ characters, an @, a domain, a dot, and a suffix. A fully RFC-5322-compliant email regex is enormous and rarely worth it: validate loosely, then confirm by sending a real message. See our tested email pattern. ### How to write a regex for phone number validation? Anchor to the specific format you accept — a flexible international check is ^\+?[1-9]\d{7,14}$ (E.164 style), while a US number is ^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$. Formats vary by country, so avoid one "global" pattern; see our US phone and E.164 patterns. ### How to write a strong password validation regex? Stack a zero-width lookahead for each rule, then check the length: ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s]).{8,}$ requires a lowercase, an uppercase, a digit, a symbol, and 8+ characters. See the strong-password pattern. ### How to validate IP addresses (IPv4/IPv6) with regex? For IPv4, validate each octet as 0–255: ^((25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(25[0-5]|2[0-4]\d|1?\d?\d)$. IPv6 is considerably more complex; use our tested IPv4 and IPv6 patterns. ### How to write a regex for date format validation? Match the structure with regex, then validate real calendar dates in code — regex cannot easily reject "Feb 30". A basic ISO check is ^\d{4}-\d{2}-\d{2}$. See our ISO, US, and EU date patterns. ### How to match dates in YYYY-MM-DD format? Use ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$ to enforce month 01–12 and day 01–31. This validates format and ranges; still reject impossible dates like 31 April in code. See the ISO-date pattern. ### How to validate a valid time in 24-hour format using regex? Use ^([01]\d|2[0-3]):[0-5]\d$ for HH:MM in 24-hour time (00:00–23:59). Append (:[0-5]\d)? for optional seconds. See the 24-hour time pattern. ### How to validate credit card numbers using regex? Validate the digit structure per network — e.g. Visa ^4\d{12}(\d{3})?$, Mastercard ^5[1-5]\d{14}$ — then verify the checksum with the Luhn algorithm, which regex cannot do. See our credit-card patterns. ### How to match a valid MAC address using regex? Use ^([0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}$ to match six hex pairs separated by colons or hyphens. See the MAC-address pattern. ### How to validate standard UUIDs/GUIDs with regex? A standard UUID is ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$. To enforce version 4 specifically, see our UUID-v4 and generic UUID patterns. ### How to match valid zip codes (US/Global formats)? US ZIP: ^\d{5}(-\d{4})?$ matches a 5-digit code or ZIP+4. Postal formats differ worldwide, so match the country you target rather than one universal pattern. See the US ZIP pattern. ### How to match a hex color code using regex? Use ^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$ to match 3- or 6-digit hex colors such as #fff or #ffffff. Extend to {8} for an alpha channel. See the hex-color pattern. ### How to match a valid floating-point decimal number? Use ^[+-]?\d+(\.\d+)?([eE][+-]?\d+)?$ to match integers, decimals, and scientific notation. For a plain decimal only, ^-?\d+\.\d+$ is enough. ### How to write a regex to match valid JSON format? Regex cannot reliably validate full JSON — it is a nested structure and regex is not built for arbitrary nesting. Parse it instead (JSON.parse in JavaScript, json.loads in Python) and catch the error. Regex is fine for pulling out individual keys — see our JSON-key pattern. ### How to check if a string is a valid Base64 using regex? Use ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ to match standard padded Base64. See the Base64 pattern. ### How to match semantic version numbers (SemVer) with regex? The official-style SemVer regex is ^\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?(?:\+[0-9A-Za-z-.]+)?$, matching MAJOR.MINOR.PATCH with optional pre-release and build metadata. See the SemVer pattern. ### How to validate an Indian Aadhaar or PAN card using regex? Indian PAN: ^[A-Z]{5}\d{4}[A-Z]$. Aadhaar (12 digits, not starting with 0 or 1): ^[2-9]\d{11}$. These check format only — the Aadhaar Verhoeff checksum cannot be done in pure regex. See our PAN and Aadhaar patterns. ### How to match valid CSS class and ID names? A valid CSS identifier is ^-?[_a-zA-Z][_a-zA-Z0-9-]*$ — it cannot start with a digit (or a digit right after a hyphen). See our CSS class and CSS id patterns. ### How to match a string without special characters? Whitelist what you allow rather than blacklisting. ^[A-Za-z0-9 ]+$ permits only letters, digits, and spaces, so anything else fails. To simply detect a special character, test for [^A-Za-z0-9]. ### How to extract URLs from text using regex? A workable pattern is https?:\/\/[^\s]+, which grabs an http or https URL up to the next whitespace. URLs are notoriously varied, so for careful work use our tested URL pattern. ### How to extract domain names from URLs using regex? Capture the host from a URL with https?:\/\/([^\/\s:]+) — group 1 is the domain. To validate a bare domain instead, see our domain-name pattern. ### How to strip HTML tags using regex? A quick strip is <[^>]+>, replacing matches with an empty string. Be warned: regex cannot safely parse arbitrary HTML — comments, scripts, and quoted angle brackets break it — so for real documents use an HTML/DOM parser. ### How to find duplicate words using regex? Use a backreference with word boundaries: \b(\w+)\s+\1\b matches a word immediately repeated. Add the i flag to catch "the The" and the g flag to find every occurrence. ### How to split a string using regex? Pass a regex as the delimiter to your language's split function. JavaScript str.split(/\s+/) splits on any run of whitespace; Python re.split(r'[,;]\s*', s) splits on commas or semicolons. A regex delimiter lets you split on variable separators a fixed string cannot express. ### How to replace multiple spaces with a single space using regex? Match a run of whitespace and replace it with a single space: str.replace(/\s+/g, ' ') in JavaScript, or re.sub(r'\s+', ' ', s) in Python. Chain .trim() to also drop leading and trailing spaces. ### How to extract text between parentheses using regex? Use a negated class inside a capture: \(([^)]*)\) — group 1 holds the text inside each pair of parentheses. Because [^)]* stops at the first closing paren, multiple pairs are matched separately. ### How to match everything up to a specific character? Use a negated class: ^[^,]* matches everything up to the first comma. To match up to but not including a character elsewhere in the string, use a lazy match with a lookahead like .*?(?=,). ### How to match a string between two specified strings? Use a lazy capture between the two delimiters: START(.*?)END captures the middle in group 1. Add the dotAll (s) flag if the content can span multiple lines. ### How to remove all emojis from a string using regex? Match emoji Unicode ranges with the u flag, e.g. str.replace(/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}]/gu, ''). Emojis span many blocks, so for full coverage use the property escape \p{Extended_Pictographic} where it is supported. ### How to extract Twitter handles / mentions using regex? Match an @-mention with (?<=^|\s)@(\w{1,15})\b — up to 15 word characters after an @, at a boundary. See the Twitter-handle pattern. ### How to match HTML attributes using regex? Capture name/value pairs with (\w+)\s*=\s*"([^"]*)" — group 1 is the attribute name and group 2 the value. This works for simple, well-formed tags; use a real HTML parser for messy markup. ### How to parse JSON keys using regex patterns? Match keys with "([^"]+)"\s*: — group 1 is each key name that precedes a colon. For anything beyond quick extraction, parse the JSON properly. See the JSON-key pattern. ### How to extract data from a CSV line using regex? A quote-aware field pattern is ("[^"]*"|[^,]*)(,|$). Because quoted commas and escaped quotes break naive patterns, prefer a real CSV parser for production data and keep regex for simple, well-formed lines. ### How to match a specific file extension using regex? Capture the extension with \.([a-zA-Z0-9]+)$ — group 1 is the text after the last dot. To match specific types, use \.(jpg|png|gif)$ with the i flag. ### How to match currency symbols and amounts with regex? Match a symbol and a formatted amount with [$€£]\s?\d{1,3}(,\d{3})*(\.\d{2})?. See our currency patterns such as USD and EUR. ### How to match a specific word using regex? Wrap the word in boundaries: \bword\b matches "word" but not "wordy" or "sword". Add the i flag for a case-insensitive match. ### How to match strings containing specific words? Use one lookahead per required word: ^(?=.*apple)(?=.*banana).*$ matches any line that contains both, in any order. Each (?=.*word) is an independent "must contain" assertion. ### How to isolate words starting with a specific letter? Use a boundary plus the letter: \bs\w* matches every word beginning with "s". Add the i flag to include capitals and the g flag to collect them all. ### How to extract hex codes from CSS files using regex? Match color hexes with #[0-9a-fA-F]{3,8}\b, capturing 3-, 6-, or 8-digit values. See the hex-color pattern. ### How to match trailing and leading whitespaces for trimming? Match edge whitespace with ^\s+|\s+$ and replace it with an empty string — the regex equivalent of trim. A built-in .trim() is faster; reach for the regex when trimming inside a larger replacement. ### How to use regex to format integers with thousand separators? Insert commas with a lookahead: str.replace(/\B(?=(\d{3})+(?!\d))/g, ',') turns 1234567 into 1,234,567. It matches every position that has a multiple of three digits remaining to its right. ### How to build a markdown link parsing regex? Match \[([^\]]+)\]\(([^)]+)\) — group 1 is the link text and group 2 the URL. See the Markdown-link pattern. ### How to write a regex pattern for YouTube video URLs? Extract the 11-character video ID with (?:youtu\.be\/|v=)([\w-]{11}), which handles both youtu.be and watch?v= forms. See the YouTube-video-ID pattern. ### How to write a regex for absolute file paths? Unix: ^\/(?:[^\/\0]+\/)*[^\/\0]+$. Windows: ^[A-Za-z]:\\(?:[^\\\/:*?"<>|]+\\?)*$. Match the operating system you target, since separators and drive letters differ. ### How to target HTML comments using regex? Match with — the [\s\S] lets it span lines and the lazy *? stops at the first "-->". See the HTML-comment pattern. ### How to filter comments (block and inline) using regex? Match both C-style forms with \/\/[^\n]*|\/\*[\s\S]*?\*\/: the first alternative catches inline // comments, the second catches /* ... */ blocks. The lazy *? keeps a block from swallowing later code. ### How to check if a string contains numbers using regex? Test for a single digit anywhere with \d — /\d/.test(str) in JavaScript returns true if any digit is present. Anchor it, as in ^\D*\d, only when the position matters. ### How to extract all numbers from a text string using regex? Use a global match rather than an anchored one: str.match(/\d+/g) in JavaScript or re.findall(r'\d+', text) in Python returns every run of digits as a list. To also capture negatives and decimals, widen the pattern to -?\d+(?:\.\d+)?. ### How to use regex in JavaScript? Create a pattern with a literal /pattern/flags or new RegExp('pattern','flags'), then use test() for true/false, match() or matchAll() to extract, and replace() to substitute. Add the g flag to act on every match. ### How to use regex in Python? Import re and use re.search (find anywhere), re.match (anchor at the start), re.findall (all matches), and re.sub (replace). Use raw strings like r'\d+' so Python does not consume the backslashes. ### How to use regex in Java? Compile with Pattern.compile("\\d+"), then drive a Matcher: m.find(), m.matches(), m.group(). Java string literals need doubled backslashes, so \d is written \\d. ### How to use regex in C# / .NET? Use System.Text.RegularExpressions.Regex with Regex.IsMatch, Regex.Match, and Regex.Replace. Verbatim strings such as @"\d+" avoid double-escaping, and .NET supports named groups and variable-length lookbehind. ### How to use regular expressions in PHP? Use the PCRE functions with delimiters: preg_match('/\d+/', $s), preg_match_all for every match, and preg_replace to substitute. The pattern must be wrapped in delimiters, usually forward slashes. ### How to use regex in Golang? Import regexp and compile with regexp.MustCompile(`\d+`), then call MatchString, FindAllString, or ReplaceAllString. Go uses the RE2 engine — linear-time and safe from catastrophic backtracking, but without lookaround or backreferences. ### How to use regex in Ruby? Use literals like /\d+/ with =~, String#match, scan (all matches), and gsub (global replace). Named captures via (?) can be read straight into local variables. ### How to use regex in Bash/Shell scripting? Use [[ $var =~ regex ]] with ERE syntax (no slashes, and do not quote the pattern), then read groups from ${BASH_REMATCH[@]}. For streams, grep -E, sed -E, and awk apply regex line by line. ### How to use regex in PowerShell? Use the -match and -replace operators or the [regex] class. After a successful -match, captured groups are available in the automatic $Matches hashtable. ### How to use regex in SQL (REGEXP_LIKE)? Use your database's native regex operator: REGEXP_LIKE(col, '^[0-9]+$') in Oracle and MySQL 8+, or the ~ operator in PostgreSQL (col ~ '^[0-9]+$'). Support varies by engine — SQL Server needs CLR for real regex — so check your database's flavor before using advanced tokens. ### How to run a case-insensitive regex match inside an SQL query? Add a case-insensitivity flag or operator: REGEXP_LIKE(col, '^abc', 'i') in Oracle and MySQL 8+, or PostgreSQL's ~* operator (col ~* '^abc'). In older MySQL, REGEXP instead follows the column's collation, so a _ci collation already matches case-insensitively. ### How to filter search queries using custom regex in Google Search Console? In the Performance report, open the Query filter and choose "Custom (regex)". Search Console uses RE2 syntax, which has no lookaheads — so to split brand from non-brand, pick the "Doesn't match regex" option with a pattern like brandname|brand name, rather than a (?!...) pattern. To surface question-style long-tail keywords, use "Matches regex" with ^(who|what|when|where|why|how|is|can|does)\b. Add the inline (?i) flag when you need to force case-insensitive matching. ### How to use regex in Google Sheets? Use the built-ins: REGEXMATCH(A1,"^\d+$") returns TRUE/FALSE, REGEXEXTRACT pulls out the first match, and REGEXREPLACE substitutes. Sheets uses RE2 syntax, so lookaround and backreferences are not available. ### How to use regex in Excel formulas? Excel 365 added native REGEXTEST, REGEXEXTRACT, and REGEXREPLACE functions; older versions need VBA's CreateObject("VBScript.RegExp"). The new functions use a PCRE-style flavor. ### How to use regex in R programming? Base R uses grepl to test, regmatches with regexpr to extract, and gsub to replace; pass perl=TRUE for PCRE features. The stringr package (str_detect, str_extract) offers a friendlier interface. ### How to use regular expressions in C++ (std::regex)? Include and use std::regex with std::regex_match, std::regex_search, and std::regex_replace. Raw string literals like R"(\d+)" spare you from escaping backslashes. ### How to use regex search in Notepad++? Open Find or Replace (Ctrl+H), tick "Regular expression", then search or replace. Notepad++ uses the Boost/PCRE flavor, and you reference captured groups in the replace box as $1, $2, and so on. ### How to use regex replace in VS Code? In Find/Replace (Ctrl+H) click the .* icon to enable regex. Reference capture groups in the replace field with $1, $2; VS Code uses JavaScript regex syntax and supports multiline search. ### How to convert regex patterns between PCRE and JavaScript flavors? Most core syntax is identical, but the differences bite: JavaScript lacks \A/\Z (use ^/$), possessive quantifiers, and recursion, while named groups use (?) in both modern engines. Our flavor converter translates a pattern between PCRE, JavaScript, and other flavors automatically. ### How to split a string in Java? Use String.split, which takes a regex: "a,b;c".split("[,;]"). Pass a limit as the second argument to cap the number of pieces, and escape metacharacters — to split on a literal dot, use "\\.". ### How to split a string in Python? For a fixed delimiter use s.split(','); for a pattern use re.split(r'[,;]\s*', s). re.split lets you divide on variable separators like a run of whitespace, r'\s+'. ### How to split a string in JavaScript? Use str.split(separator), where the separator is a string or a regex. "a1b2c".split(/\d/) splits on any digit — a regex separator lets you break on patterns a plain string cannot express. ### How to check if a string contains a substring in Python? To simply check membership, use 'sub' in text — no regex needed and it is faster. For a pattern-based check, use re.search(r'pattern', text), which returns a match object (truthy) or None. ### How to validate email in JavaScript? Test with /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email), which returns true or false. For most forms, a native plus this light check is enough; avoid over-strict patterns that reject valid addresses. See the email pattern. ### What is catastrophic backtracking in regex? It happens when nested or overlapping quantifiers — like (a+)+ — force the engine to try exponentially many ways to match a failing string, hanging your program. Avoid ambiguous nesting, use atomic or possessive groups where supported, and prefer specific character classes over .*. ### What is ReDoS (Regex Denial of Service)? Regular-expression Denial of Service is an attack that feeds crafted input to a vulnerable pattern to trigger catastrophic backtracking and exhaust CPU. Defend by avoiding nested quantifiers, adding timeouts, or using a linear-time engine like RE2, and never run untrusted patterns against untrusted input. ### How to use regex to find SQL injection patterns? Regex is a weak defense against SQL injection — attackers slip past keyword blacklists easily. Use parameterized queries and prepared statements instead. If you must scan, flags such as ('|--|;|\b(UNION|SELECT|DROP)\b) can surface suspicious input for logging, not as your primary control. ### How to parse Cron expressions using regex? A five-field cron line can be matched field by field; a permissive shape is ^(\S+\s+){4}\S+$, but validating real ranges needs a longer pattern. See our cron-expression pattern. ## Pattern Library (300 tested regex patterns) - Alphanumeric — `^[A-Za-z0-9]+$` — (https://regexguide.com/patterns/alphanumeric.html) - Generic API key — `^[A-Za-z0-9_\-]{20,64}$` — (https://regexguide.com/patterns/api-key-generic.html) - Argentine CPA — `^[A-Z]\d{4}[A-Z]{3}$` — (https://regexguide.com/patterns/argentina-postal.html) - Australian ABN — `^\d{2}\s?\d{3}\s?\d{3}\s?\d{3}$` — (https://regexguide.com/patterns/australia-abn.html) - Australian phone (+61) — `^(\+61|0)[\s\-]?[2-478][\s\-]?\d{4}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/australia-phone.html) - Australian postcode — `^\d{4}$` — (https://regexguide.com/patterns/australia-postcode.html) - Australian TFN — `^\d{3}\s?\d{3}\s?\d{2,3}$` — (https://regexguide.com/patterns/australia-tfn.html) - Base64 string — `^[A-Za-z0-9+/]+={0,2}$` — (https://regexguide.com/patterns/base64.html) - Between two strings — `BEGIN(.*?)END` — (https://regexguide.com/patterns/between-two-strings.html) - Binary number with 0b prefix — `^0[bB][01]+$` — (https://regexguide.com/patterns/binary-number.html) - Bitcoin SegWit address (bech32) — `^(bc1)[02-9ac-hj-np-z]{38,87}$` — (https://regexguide.com/patterns/bitcoin-address-bech32.html) - Bitcoin address (legacy) — `^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$` — (https://regexguide.com/patterns/bitcoin-address-legacy.html) - Block comment (/* */) — `\/\*[\s\S]*?\*\/` — (https://regexguide.com/patterns/block-comment.html) - Brazilian CEP — `^\d{5}-?\d{3}$` — (https://regexguide.com/patterns/brazil-cep.html) - Brazilian CNPJ — `^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$` — (https://regexguide.com/patterns/brazil-cnpj.html) - Brazilian CPF — `^\d{3}\.\d{3}\.\d{3}-\d{2}$` — (https://regexguide.com/patterns/brazil-cpf.html) - Brazilian phone (+55) — `^\+55[\s\-]?\(?\d{2}\)?[\s\-]?9?\d{4}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/brazil-phone.html) - camelCase identifier — `^[a-z]+([A-Z][a-z0-9]*)*$` — (https://regexguide.com/patterns/camelcase.html) - Canadian postal code — `^[A-CEGHJ-NPRSTVXY]\d[A-CEGHJ-NPRSTV-Z]\s?\d[A-CEGHJ-NPRSTV-Z]\d$` — (https://regexguide.com/patterns/canada-postal.html) - Canadian SIN — `^\d{3}[\-\s]?\d{3}[\-\s]?\d{3}$` — (https://regexguide.com/patterns/canada-sin.html) - Card expiry (MM/YY) — `^(0[1-9]|1[0-2])/\d{2}$` — (https://regexguide.com/patterns/card-expiry.html) - Chinese citizen ID — `^\d{17}[\dXx]$` — (https://regexguide.com/patterns/china-citizen-id.html) - Chinese mobile number — `^1[3-9]\d{9}$` — (https://regexguide.com/patterns/china-mobile.html) - Chinese postal code — `^\d{6}$` — (https://regexguide.com/patterns/china-postal.html) - CONSTANT_CASE — `^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$` — (https://regexguide.com/patterns/constant-case.html) - American Express — `^3[47]\d{13}$` — (https://regexguide.com/patterns/credit-card-amex.html) - Discover — `^6(011|5\d{2}|4[4-9]\d|22[1-9]\d{2})\d{12}$` — (https://regexguide.com/patterns/credit-card-discover.html) - Mastercard — `^(5[1-5]\d{2}|222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$` — (https://regexguide.com/patterns/credit-card-mastercard.html) - RuPay card — `^(508[5-9]|6069|607[0-9]|608[0-7]|6521|6522)\d{12}$` — (https://regexguide.com/patterns/credit-card-rupay.html) - Visa card — `^4\d{12}(\d{3})?$` — (https://regexguide.com/patterns/credit-card-visa.html) - Credit card (any major) — `^(?:4\d{12}(?:\d{3})?|(?:5[1-5]\d{2}|222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|3[47]\d{13}|6(?:011|5\d{2}|4[4-9]\d|22[1-9]\d{2})\d{12}|(?:508[5-9]|6069|607[0-9]|608[0-7]|6521|6522)\d{12})$` — (https://regexguide.com/patterns/credit-card.html) - Cron expression (5-field) — `^(\*|[0-5]?\d|\*\/\d+|[0-5]?\d-[0-5]?\d|[0-5]?\d(,[0-5]?\d)+)\s+(\*|1?\d|2[0-3]|\*\/\d+|\d+-\d+|\d+(,\d+)+)\s+(\*|[1-9]|[12]\d|3[01]|\*\/\d+|\d+-\d+|\?|L|W)\s+(\*|[1-9]|1[0-2]|\*\/\d+|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)\s+(\*|[0-6]|\*\/\d+|MON|TUE|WED|THU|FRI|SAT|SUN|\?|L)$` — (https://regexguide.com/patterns/cron-expression.html) - CSS class selector — `\.[a-zA-Z_][a-zA-Z0-9_-]*` — (https://regexguide.com/patterns/css-class.html) - CSS hsl() / hsla() color — `^hsla?\(\s*\d+(deg)?\s*,\s*\d+%\s*,\s*\d+%\s*(,\s*(0|1|0?\.\d+)\s*)?\)$` — (https://regexguide.com/patterns/css-color-hsl.html) - CSS rgb() / rgba() color — `^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*(0|1|0?\.\d+)\s*)?\)$` — (https://regexguide.com/patterns/css-color-rgb.html) - CSS ID selector — `#[a-zA-Z_][a-zA-Z0-9_-]*` — (https://regexguide.com/patterns/css-id.html) - Euro amount — `^€?\s?-?(\d{1,3}([.,]\d{3})+|\d+)([.,]\d{2})?\s?€?$` — (https://regexguide.com/patterns/currency-eur.html) - Pound Sterling amount — `^-?£?(\d{1,3}(,\d{3})+|\d+)(\.\d{2})?$` — (https://regexguide.com/patterns/currency-gbp.html) - Japanese Yen amount — `^-?¥?(\d{1,3}(,\d{3})+|\d+)$` — (https://regexguide.com/patterns/currency-jpy.html) - Currency amount (USD) — `^-?\$?(\d{1,3}(,\d{3})+|\d+)(\.\d{2})?$` — (https://regexguide.com/patterns/currency-usd.html) - CUSIP (security ID) — `^[0-9A-Z]{9}$` — (https://regexguide.com/patterns/cusip.html) - CVV / CVC code — `^\d{3,4}$` — (https://regexguide.com/patterns/cvv.html) - Day of week name — `^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|Mon|Tue|Wed|Thu|Fri|Sat|Sun)$` — (https://regexguide.com/patterns/day-name.html) - Decimal number — `^-?\d+(\.\d+)?$` — (https://regexguide.com/patterns/decimal.html) - Discord username (new) — `^[a-z0-9._]{2,32}$` — (https://regexguide.com/patterns/discord-username.html) - Docker image tag — `^[a-z0-9]+([._-][a-z0-9]+)*(/[a-z0-9]+([._-][a-z0-9]+)*)*(:[\w][\w.-]{0,127})?$` — (https://regexguide.com/patterns/docker-image-tag.html) - Docker volume mount — `^[^:]+:[^:]+(:(ro|rw|z|Z|cached|delegated|consistent))?$` — (https://regexguide.com/patterns/docker-volume.html) - Domain name — `^(?!-)[A-Za-z0-9-]{1,63}(?|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$` — (https://regexguide.com/patterns/file-path-windows.html) - Fraction (N/M) — `^-?\d+\/\d+$` — (https://regexguide.com/patterns/fraction.html) - French phone (+33) — `^\+33[\s\-]?[1-9](\s?\d{2}){4}$` — (https://regexguide.com/patterns/france-phone.html) - French postal code — `^\d{5}$` — (https://regexguide.com/patterns/france-postal.html) - French SIREN — `^\d{9}$` — (https://regexguide.com/patterns/france-siren.html) - French SIRET — `^\d{14}$` — (https://regexguide.com/patterns/france-siret.html) - Full name — `^[A-Za-z\u00C0-\u017F][A-Za-z\u00C0-\u017F'\- ]+$` — (https://regexguide.com/patterns/full-name.html) - German IBAN — `^DE\d{20}$` — (https://regexguide.com/patterns/germany-iban.html) - German phone (+49) — `^\+49[\s\-]?\d{2,4}[\s\-]?\d{4,11}$` — (https://regexguide.com/patterns/germany-phone.html) - German Steuer-ID — `^\d{11}$` — (https://regexguide.com/patterns/germany-steuer-id.html) - Git branch name — `^(?!\/|.*([\/]\.|\/\/|@\{|\\))[^\040\177 ~^:?*\[]+\/?(?` — (https://regexguide.com/patterns/html-comment.html) - HTML entity — `&(#\d+|#x[0-9a-fA-F]+|[a-zA-Z]+);` — (https://regexguide.com/patterns/html-entity.html) - HTML tag — `<\/?[a-zA-Z][a-zA-Z0-9]*(\s+[a-zA-Z-]+(\s*=\s*("[^"]*"|\'[^\']*\'|[^\s>]+))?)*\s*\/?>` — (https://regexguide.com/patterns/html-tag.html) - HTTP header line — `^([A-Za-z][A-Za-z0-9-]*):\s*(.+?)\s*$` — (https://regexguide.com/patterns/http-header.html) - HTTP method — `^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)$` — (https://regexguide.com/patterns/http-method.html) - HTTP 4xx (client error) — `^4\d{2}$` — (https://regexguide.com/patterns/http-status-client-error.html) - HTTP 3xx (redirect) — `^3\d{2}$` — (https://regexguide.com/patterns/http-status-redirect.html) - HTTP 5xx (server error) — `^5\d{2}$` — (https://regexguide.com/patterns/http-status-server-error.html) - HTTP 2xx (success) — `^2\d{2}$` — (https://regexguide.com/patterns/http-status-success.html) - HTTP status code — `^[1-5]\d{2}$` — (https://regexguide.com/patterns/http-status.html) - IBAN — `^[A-Z]{2}\d{2}[A-Z0-9]{1,30}$` — (https://regexguide.com/patterns/iban.html) - Aadhaar enrollment ID (EID) — `^\d{4}/\d{5}/\d{5}\s\d{2}/\d{2}/\d{4}\s\d{2}:\d{2}:\d{2}$` — (https://regexguide.com/patterns/india-aadhaar-enrollment.html) - Aadhaar (masked) — `^X{4}\s?X{4}\s?\d{4}$` — (https://regexguide.com/patterns/india-aadhaar-masked.html) - Aadhaar (with spaces) — `^[2-9]\d{3}\s\d{4}\s\d{4}$` — (https://regexguide.com/patterns/india-aadhaar-spaced.html) - Aadhaar Virtual ID (VID) — `^[2-9]\d{15}$` — (https://regexguide.com/patterns/india-aadhaar-vid.html) - Aadhaar number — `^[2-9]\d{11}$` — (https://regexguide.com/patterns/india-aadhaar.html) - ABHA address (handle) — `^[a-zA-Z0-9.\-_]{2,}@(abdm|sbx|[a-zA-Z][a-zA-Z0-9]+)$` — (https://regexguide.com/patterns/india-abha-address.html) - ABHA (Health ID) — `^\d{2}-\d{4}-\d{4}-\d{4}$` — (https://regexguide.com/patterns/india-abha.html) - Indian bank account number — `^\d{9,18}$` — (https://regexguide.com/patterns/india-bank-account.html) - Blue Dart AWB — `^\d{8,11}$` — (https://regexguide.com/patterns/india-bluedart.html) - BSE scrip code — `^\d{6}$` — (https://regexguide.com/patterns/india-bse-code.html) - CBSE roll number — `^\d{7}$` — (https://regexguide.com/patterns/india-cbse-roll.html) - Cheque number — `^\d{6}$` — (https://regexguide.com/patterns/india-cheque-number.html) - HDFC Customer ID — `^\d{8}$` — (https://regexguide.com/patterns/india-cif-hdfc.html) - ICICI Customer ID — `^\d{8}$` — (https://regexguide.com/patterns/india-cif-icici.html) - SBI CIF Number — `^\d{11}$` — (https://regexguide.com/patterns/india-cif-sbi.html) - CIN (Corporate Identification Number) — `^[LU]\d{5}[A-Z]{2}\d{4}[A-Z]{3}\d{6}$` — (https://regexguide.com/patterns/india-cin.html) - Axis Customer ID — `^\d{9}$` — (https://regexguide.com/patterns/india-cust-axis.html) - CDSL Demat account — `^\d{16}$` — (https://regexguide.com/patterns/india-demat-cdsl.html) - NSDL Demat account — `^IN\d{14}$` — (https://regexguide.com/patterns/india-demat-nsdl.html) - DIN (Director Identification Number) — `^\d{8}$` — (https://regexguide.com/patterns/india-din.html) - Domestic airline PNR — `^[A-Z0-9]{6}$` — (https://regexguide.com/patterns/india-domestic-air-pnr.html) - Indian driving licence — `^[A-Z]{2}[\s\-]?\d{2}[\s\-]?(19|20)\d{2}[\s\-]?\d{7}$` — (https://regexguide.com/patterns/india-driving-licence.html) - Drug license number — `^\d{2}/\d{2}/[A-Z]{2}/\d{4}/\d{4,6}$` — (https://regexguide.com/patterns/india-drug-license.html) - DTDC tracking number — `^[A-Z]{1,2}\d{8,11}$` — (https://regexguide.com/patterns/india-dtdc-tracking.html) - Dish TV VC number — `^\d{11}$` — (https://regexguide.com/patterns/india-dth-dishtv.html) - Tata Sky / Tata Play subscriber ID — `^1\d{9}$` — (https://regexguide.com/patterns/india-dth-tatasky.html) - IRDAI E-IA (Insurance e-Account) — `^\d{13}$` — (https://regexguide.com/patterns/india-eia.html) - EPF UAN — `^\d{12}$` — (https://regexguide.com/patterns/india-epf-uan.html) - ESI number — `^\d{17}$` — (https://regexguide.com/patterns/india-esi.html) - GST E-way bill — `^\d{12}$` — (https://regexguide.com/patterns/india-eway-bill.html) - FSSAI license — `^[1-2]\d{13}$` — (https://regexguide.com/patterns/india-fssai.html) - GATE enrollment ID — `^GATE\d{9}$` — (https://regexguide.com/patterns/india-gate-reg.html) - GSTIN — `^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]$` — (https://regexguide.com/patterns/india-gstin.html) - HSN code — `^\d{2}(\d{2}(\d{2}(\d{2})?)?)?$` — (https://regexguide.com/patterns/india-hsn.html) - ICSE/ISC roll number — `^[A-Z]\d{6}$` — (https://regexguide.com/patterns/india-icse-roll.html) - IEC (Importer Exporter Code) — `^[A-Z0-9]{10}$` — (https://regexguide.com/patterns/india-iec.html) - IFSC code — `^[A-Z]{4}0[A-Z0-9]{6}$` — (https://regexguide.com/patterns/india-ifsc.html) - IMPS reference number — `^\d{12}$` — (https://regexguide.com/patterns/india-imps-ref.html) - IRCTC User ID — `^[a-zA-Z][a-zA-Z0-9_]{2,9}$` — (https://regexguide.com/patterns/india-irctc-userid.html) - ISIN (Indian) — `^IN[EFA9][A-Z0-9]{9}\d$` — (https://regexguide.com/patterns/india-isin.html) - ITR Acknowledgement number — `^\d{15}$` — (https://regexguide.com/patterns/india-itr-ack.html) - JEE application number — `^\d{12}$` — (https://regexguide.com/patterns/india-jee-application.html) - Indian comma format (lakh/crore) — `^\d{1,2}(,\d{2})*,\d{3}(\.\d+)?$` — (https://regexguide.com/patterns/india-lakh-format.html) - Indian landline number — `^(\+91[\s\-]?|0)?\d{2,4}[\s\-]?\d{6,8}$` — (https://regexguide.com/patterns/india-landline.html) - LIC policy number — `^\d{9}$` — (https://regexguide.com/patterns/india-lic-policy.html) - LLPIN (LLP Identification) — `^[A-Z]{3}\-\d{4}$` — (https://regexguide.com/patterns/india-llpin.html) - MICR code — `^\d{9}$` — (https://regexguide.com/patterns/india-micr.html) - MMID (Mobile Money Identifier) — `^\d{7}$` — (https://regexguide.com/patterns/india-mmid.html) - Indian mobile with +91 — `^(\+91[\-\s]?|0)?[6-9]\d{9}$` — (https://regexguide.com/patterns/india-mobile-with-cc.html) - Indian mobile number — `^[6-9]\d{9}$` — (https://regexguide.com/patterns/india-mobile.html) - NEET roll number — `^\d{12}$` — (https://regexguide.com/patterns/india-neet-roll.html) - PAN — Individual — `^[A-Z]{3}P[A-Z][0-9]{4}[A-Z]$` — (https://regexguide.com/patterns/india-pan-individual.html) - PAN (Permanent Account Number) — `^[A-Z]{5}[0-9]{4}[A-Z]$` — (https://regexguide.com/patterns/india-pan.html) - Indian passport number — `^[A-PR-WY][1-9]\d\s?\d{4}[1-9]$` — (https://regexguide.com/patterns/india-passport.html) - EPF Member ID — `^[A-Z]{2}/[A-Z]{3}/\d{7}/\d{3}/\d{7}$` — (https://regexguide.com/patterns/india-pf-member.html) - PIN code (postal) — `^[1-9]\d{5}$` — (https://regexguide.com/patterns/india-pin-code.html) - PUC certificate number — `^[A-Z0-9]{13,15}$` — (https://regexguide.com/patterns/india-pollution-cert.html) - India Post tracking number — `^[A-Z]{2}\d{9}IN$` — (https://regexguide.com/patterns/india-post-tracking.html) - PRAN (NPS account) — `^\d{12}$` — (https://regexguide.com/patterns/india-pran.html) - Premium-rate 1900 number — `^1900[\s\-]?\d{2,3}[\s\-]?\d{4,7}$` — (https://regexguide.com/patterns/india-premium-1900.html) - Indian Railways PNR — `^\d{10}$` — (https://regexguide.com/patterns/india-railway-pnr.html) - Indian rupee amount — `^(₹|Rs\.?\s?|INR\s?)?\d{1,3}(,\d{2,3})*(\.\d{1,2})?$` — (https://regexguide.com/patterns/india-rupee-amount.html) - SAC code — `^99\d{4}$` — (https://regexguide.com/patterns/india-sac.html) - Speed Post tracking — `^E[EM]\d{9}IN$` — (https://regexguide.com/patterns/india-speedpost.html) - SSC examination roll number — `^\d{11}$` — (https://regexguide.com/patterns/india-ssc-roll.html) - Indian state/UT 2-letter code — `^(AN|AP|AR|AS|BR|CG|CH|DH|DL|DN|GA|GJ|HP|HR|JH|JK|KA|KL|LA|LD|MH|ML|MN|MP|MZ|NL|OD|OR|PB|PY|RJ|SK|TN|TR|TS|UK|UP|WB)$` — (https://regexguide.com/patterns/india-state-code.html) - Railway station code — `^[A-Z]{2,5}$` — (https://regexguide.com/patterns/india-station-code.html) - TAN (Tax Deduction Account Number) — `^[A-Z]{4}\d{5}[A-Z]$` — (https://regexguide.com/patterns/india-tan.html) - Toll-free 1800 number — `^1800[\s\-]?\d{2,3}[\s\-]?\d{4,7}$` — (https://regexguide.com/patterns/india-toll-free-1800.html) - Toll-free 1860 number — `^1860[\s\-]?\d{2,3}[\s\-]?\d{4,7}$` — (https://regexguide.com/patterns/india-toll-free-1860.html) - Trade license number — `^[A-Z]{2,3}/\d{4}/\d{4,8}$` — (https://regexguide.com/patterns/india-trade-license.html) - Train number — `^\d{5}$` — (https://regexguide.com/patterns/india-train-number.html) - UAM (Udyog Aadhaar Memorandum) — `^[A-Z]{2}\d{2}[A-Z]\d{7}$` — (https://regexguide.com/patterns/india-uam.html) - Udyam Registration — `^UDYAM-[A-Z]{2}-\d{2}-\d{7}$` — (https://regexguide.com/patterns/india-udyam.html) - UGC-NET roll number — `^\d{12}$` — (https://regexguide.com/patterns/india-ugc-net-roll.html) - UPI ID (VPA) — `^[a-zA-Z0-9.\-_]{2,256}@[a-zA-Z][a-zA-Z]{2,64}$` — (https://regexguide.com/patterns/india-upi.html) - UPSC roll number — `^\d{7}$` — (https://regexguide.com/patterns/india-upsc-roll.html) - RTGS UTR — `^[A-Z]{4}[A-Z0-9]{6}\d{12}$` — (https://regexguide.com/patterns/india-utr-rtgs.html) - Andhra Pradesh vehicle registration — `^AP[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-ap.html) - Assam vehicle registration — `^AS[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-as.html) - Bharat (BH) series vehicle — `^\d{2}[\s\-]?BH[\s\-]?\d{4}[\s\-]?[A-Z]{2}$` — (https://regexguide.com/patterns/india-vehicle-bh.html) - Bihar vehicle registration — `^BR[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-br.html) - Chhattisgarh vehicle registration — `^CG[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-cg.html) - Commercial vehicle (yellow plate) — `^[A-Z]{2}[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-commercial.html) - Delhi vehicle registration — `^DL[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-dl.html) - Electric vehicle plate (green) — `^[A-Z]{2}[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-ev.html) - Gujarat vehicle registration — `^GJ[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-gj.html) - Himachal Pradesh vehicle registration — `^HP[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-hp.html) - Haryana vehicle registration — `^HR[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-hr.html) - Jharkhand vehicle registration — `^JH[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-jh.html) - Karnataka vehicle registration — `^KA[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-ka.html) - Kerala vehicle registration — `^KL[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-kl.html) - Maharashtra vehicle registration — `^MH[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-mh.html) - Madhya Pradesh vehicle registration — `^MP[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-mp.html) - Odisha vehicle registration — `^OD[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-od.html) - Punjab vehicle registration — `^PB[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-pb.html) - Indian vehicle registration — `^[A-Z]{2}[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-registration.html) - Rajasthan vehicle registration — `^RJ[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-rj.html) - Tamil Nadu vehicle registration — `^TN[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-tn.html) - Telangana vehicle registration — `^TS[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-ts.html) - Uttarakhand vehicle registration — `^UK[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-uk-state.html) - Uttar Pradesh vehicle registration — `^UP[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-up.html) - West Bengal vehicle registration — `^WB[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/india-vehicle-wb.html) - Voter ID (EPIC) — `^[A-Z]{3}\d{7}$` — (https://regexguide.com/patterns/india-voter-id.html) - Indonesia NIK — `^\d{16}$` — (https://regexguide.com/patterns/indonesia-nik.html) - Instagram handle — `^@?[a-zA-Z0-9._]{1,30}$` — (https://regexguide.com/patterns/instagram-handle.html) - Positive integer — `^(0|[1-9]\d*)$` — (https://regexguide.com/patterns/integer-positive.html) - Signed integer — `^-?(0|[1-9]\d*)$` — (https://regexguide.com/patterns/integer-signed.html) - International phone (E.164) — `^\+[1-9]\d{6,14}$` — (https://regexguide.com/patterns/international-phone-e164.html) - IPv4 address — `^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$` — (https://regexguide.com/patterns/ipv4.html) - IPv6 address — `^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:(:[0-9a-fA-F]{1,4}){1,6}|:((:[0-9a-fA-F]{1,4}){1,7}|:))$` — (https://regexguide.com/patterns/ipv6.html) - ISBN-10 — `^(?=(?:\D*\d){9}[\dX])\d{1,5}-?\d{1,7}-?\d{1,6}-?[\dX]$` — (https://regexguide.com/patterns/isbn-10.html) - ISBN-13 — `^(?=(?:\D*\d){13})97[89][\d-]+$` — (https://regexguide.com/patterns/isbn-13.html) - ISO 8601 date (YYYY-MM-DD) — `^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$` — (https://regexguide.com/patterns/iso-date.html) - ISO 8601 datetime — `^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})?$` — (https://regexguide.com/patterns/iso-datetime.html) - ISO 8601 week date — `^\d{4}-W(0[1-9]|[1-4]\d|5[0-3])-[1-7]$` — (https://regexguide.com/patterns/iso-week-date.html) - Italian Codice Fiscale — `^[A-Z]{6}\d{2}[A-EHLMPRST]\d{2}[A-Z]\d{3}[A-Z]$` — (https://regexguide.com/patterns/italy-codice-fiscale.html) - Italian CAP postal — `^\d{5}$` — (https://regexguide.com/patterns/italy-postal.html) - Japanese My Number — `^\d{12}$` — (https://regexguide.com/patterns/japan-my-number.html) - Japanese phone — `^(\+81[\s\-]?|0)\d{1,4}[\s\-]?\d{1,4}[\s\-]?\d{3,4}$` — (https://regexguide.com/patterns/japan-phone.html) - Japanese postal code — `^\d{3}-\d{4}$` — (https://regexguide.com/patterns/japan-postal.html) - JSON key — `"([^"\\]|\\.)*"\s*:` — (https://regexguide.com/patterns/json-key.html) - JWT token — `^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*$` — (https://regexguide.com/patterns/jwt.html) - Kubernetes resource name — `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` — (https://regexguide.com/patterns/k8s-name.html) - kebab-case identifier — `^[a-z][a-z0-9]*(-[a-z0-9]+)*$` — (https://regexguide.com/patterns/kebab-case.html) - Korean RRN — `^\d{6}-[1-8]\d{6}$` — (https://regexguide.com/patterns/korea-rrn.html) - Letters only — `^[A-Za-z]+$` — (https://regexguide.com/patterns/letters-only.html) - Line comment (// or #) — `(\/\/|#).*$` — (https://regexguide.com/patterns/line-comment.html) - LinkedIn profile URL — `^https?:\/\/(www\.)?linkedin\.com\/in\/[A-Za-z0-9\-_%]+\/?$` — (https://regexguide.com/patterns/linkedin-profile.html) - Linux username — `^[a-z_][a-z0-9_-]*[$]?$` — (https://regexguide.com/patterns/linux-username.html) - MAC address (Cisco format) — `^[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}$` — (https://regexguide.com/patterns/mac-address-cisco.html) - MAC address — `^([0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}$` — (https://regexguide.com/patterns/mac-address.html) - Malaysia MyKad — `^\d{6}-\d{2}-\d{4}$` — (https://regexguide.com/patterns/malaysia-mykad.html) - Markdown image — `!\[([^\]]*)\]\(([^)]+)\)` — (https://regexguide.com/patterns/markdown-image.html) - Markdown link — `\[([^\]]+)\]\(([^)]+)\)` — (https://regexguide.com/patterns/markdown-link.html) - MD5 hash — `^[0-9a-fA-F]{32}$` — (https://regexguide.com/patterns/md5.html) - @Mention — `@[A-Za-z][A-Za-z0-9_]{1,29}` — (https://regexguide.com/patterns/mention.html) - Mexican phone (+52) — `^\+52[\s\-]?1?[\s\-]?\d{2,3}[\s\-]?\d{3,4}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/mexico-phone.html) - Mexican postal code — `^\d{5}$` — (https://regexguide.com/patterns/mexico-postal.html) - MIME type — `^[a-zA-Z]+\/[a-zA-Z0-9.+-]+$` — (https://regexguide.com/patterns/mime-type.html) - Month name — `^(January|February|March|April|May|June|July|August|September|October|November|December|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)$` — (https://regexguide.com/patterns/month-name.html) - Dutch postal code — `^\d{4}\s?[A-Z]{2}$` — (https://regexguide.com/patterns/netherlands-postal.html) - Octal number with 0o prefix — `^0[oO][0-7]+$` — (https://regexguide.com/patterns/octal-number.html) - Ordinal number — `^\d+(st|nd|rd|th)$` — (https://regexguide.com/patterns/ordinal-number.html) - PascalCase identifier — `^[A-Z][a-zA-Z0-9]*$` — (https://regexguide.com/patterns/pascalcase.html) - Alphanumeric password — `^[A-Za-z0-9]{8,}$` — (https://regexguide.com/patterns/password-alphanumeric.html) - Medium password — `^(?=.*[A-Za-z])(?=.*\d).{8,}$` — (https://regexguide.com/patterns/password-medium.html) - Strong password — `^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s]).{8,}$` — (https://regexguide.com/patterns/password-strong.html) - Percentage (0-100%) — `^(100(\.0+)?|\d{1,2}(\.\d+)?)\s*%?$` — (https://regexguide.com/patterns/percentage.html) - Phone with extension — `^.+(\s+(ext\.?|x|extension)\s*\d+)$` — (https://regexguide.com/patterns/phone-number-extension.html) - Polish postal code — `^\d{2}-\d{3}$` — (https://regexguide.com/patterns/poland-postal.html) - Port number — `^(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)$` — (https://regexguide.com/patterns/port-number.html) - Positive decimal — `^\d+(\.\d+)?$` — (https://regexguide.com/patterns/positive-float.html) - PEM-encoded key/certificate — `-----BEGIN [A-Z ]+-----[\s\S]+?-----END [A-Z ]+-----` — (https://regexguide.com/patterns/private-key-pem.html) - Year + quarter — `^(Q[1-4][\s\-/]?\d{4}|\d{4}[\s\-/]?Q[1-4])$` — (https://regexguide.com/patterns/quarter-year.html) - URL query parameter — `(?:^|[?&])([^=&]+)=([^&]*)` — (https://regexguide.com/patterns/query-parameter.html) - Quoted string — `(["\'])(?:(?=(\\?))\2.)*?\1` — (https://regexguide.com/patterns/quoted-string.html) - Regex flag string — `^[gimsuyd]*$` — (https://regexguide.com/patterns/regex-flags.html) - RFC 2822 date — `^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{1,2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{4} \d{2}:\d{2}:\d{2} [+-]\d{4}$` — (https://regexguide.com/patterns/rfc-2822-date.html) - Roman numerals — `^M{0,3}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$` — (https://regexguide.com/patterns/roman-numerals.html) - Russian phone (+7) — `^(\+7|8)[\s\-]?\(?\d{3}\)?[\s\-]?\d{3}[\s\-]?\d{2}[\s\-]?\d{2}$` — (https://regexguide.com/patterns/russia-phone.html) - Russian postal code — `^\d{6}$` — (https://regexguide.com/patterns/russia-postal.html) - Scientific notation — `^-?\d+(\.\d+)?[eE][+-]?\d+$` — (https://regexguide.com/patterns/scientific-notation.html) - Semver range (npm style) — `^([\^~>=<]+)?\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.-]+)?$` — (https://regexguide.com/patterns/semver-range.html) - Semantic version — `^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$` — (https://regexguide.com/patterns/semver.html) - SHA-1 hash — `^[0-9a-fA-F]{40}$` — (https://regexguide.com/patterns/sha1.html) - SHA-256 hash — `^[0-9a-fA-F]{64}$` — (https://regexguide.com/patterns/sha256.html) - Shell variable assignment — `^[A-Za-z_][A-Za-z0-9_]*=` — (https://regexguide.com/patterns/shell-variable.html) - Singapore NRIC — `^[STFGM]\d{7}[A-Z]$` — (https://regexguide.com/patterns/singapore-nric.html) - URL slug — `^[a-z0-9]+(?:-[a-z0-9]+)*$` — (https://regexguide.com/patterns/slug.html) - snake_case identifier — `^[a-z][a-z0-9]*(_[a-z0-9]+)*$` — (https://regexguide.com/patterns/snake_case.html) - Solana address — `^[1-9A-HJ-NP-Za-km-z]{32,44}$` — (https://regexguide.com/patterns/solana-address.html) - South African phone (+27) — `^(\+27|0)[\s\-]?\d{2}[\s\-]?\d{3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/south-africa-phone.html) - Spanish DNI — `^\d{8}[A-Z]$` — (https://regexguide.com/patterns/spain-dni.html) - Spanish NIE — `^[XYZ]\d{7}[A-Z]$` — (https://regexguide.com/patterns/spain-nie.html) - Spanish postal code — `^(0[1-9]|[1-4]\d|5[0-2])\d{3}$` — (https://regexguide.com/patterns/spain-postal.html) - Spotify URI — `^spotify:(track|album|playlist|artist|episode|show):[A-Za-z0-9]{22}$` — (https://regexguide.com/patterns/spotify-uri.html) - SQL comment — `(--[^\n]*|\/\*[\s\S]*?\*\/)` — (https://regexguide.com/patterns/sql-comment.html) - SSH public key — `^(ssh-rsa|ssh-ed25519|ecdsa-sha2-nistp\d+|ssh-dss)\s+[A-Za-z0-9+/]+=*(\s+[^\s]+)?$` — (https://regexguide.com/patterns/ssh-public-key.html) - SWIFT/BIC code — `^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$` — (https://regexguide.com/patterns/swift-bic.html) - Taiwan ID number — `^[A-Z][12]\d{8}$` — (https://regexguide.com/patterns/taiwan-id.html) - Thai national ID — `^\d{13}$` — (https://regexguide.com/patterns/thailand-national-id.html) - 12-hour time (with AM/PM) — `^(0?[1-9]|1[0-2]):[0-5]\d\s?(AM|PM|am|pm)$` — (https://regexguide.com/patterns/time-12h.html) - 24-hour time (HH:MM) — `^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$` — (https://regexguide.com/patterns/time-24h.html) - Timezone offset — `^[+-](0\d|1[0-4]):?[0-5]\d$` — (https://regexguide.com/patterns/timezone-offset.html) - TODO / FIXME marker — `(TODO|FIXME|HACK|XXX|NOTE)(\([^)]+\))?:\s*(.*)` — (https://regexguide.com/patterns/todo-marker.html) - Twitter/X handle — `@([A-Za-z0-9_]{1,15})\b` — (https://regexguide.com/patterns/twitter-handle.html) - UAE phone (+971) — `^\+971[\s\-]?\d{1,2}[\s\-]?\d{3}[\s\-]?\d{4}$` — (https://regexguide.com/patterns/uae-phone.html) - UK mobile number — `^(\+44\s?|0)7\d{3}\s?\d{6}$` — (https://regexguide.com/patterns/uk-mobile.html) - UK National Insurance Number — `^(?!BG|GB|NK|KN|TN|NT|ZZ)[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z]\d{6}[A-D]?$` — (https://regexguide.com/patterns/uk-ni-number.html) - UK phone number — `^(\+44\s?|0)(\d{2,5}\s?)(\d{3,4}\s?\d{3,4})$` — (https://regexguide.com/patterns/uk-phone.html) - UK postcode — `^[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}$` — (https://regexguide.com/patterns/uk-postcode.html) - UK sort code — `^\d{2}-?\d{2}-?\d{2}$` — (https://regexguide.com/patterns/uk-sort-code.html) - Unix timestamp (milliseconds) — `^\d{13}$` — (https://regexguide.com/patterns/unix-timestamp-millis.html) - Unix timestamp (seconds) — `^\d{10}$` — (https://regexguide.com/patterns/unix-timestamp-seconds.html) - URL / web address — `^https?://[^\s/$.?#].[^\s]*$` — (https://regexguide.com/patterns/url.html) - US date (MM/DD/YYYY) — `^(0[1-9]|1[0-2])/(0[1-9]|[12]\d|3[01])/\d{4}$` — (https://regexguide.com/patterns/us-date.html) - US driver's license (generic) — `^[A-Z]\d{7,8}$` — (https://regexguide.com/patterns/us-driver-license-generic.html) - US EIN — `^\d{2}-\d{7}$` — (https://regexguide.com/patterns/us-ein.html) - US ITIN — `^9\d{2}-(7\d|8[0-8]|9[0-2]|9[4-9])-\d{4}$` — (https://regexguide.com/patterns/us-itin.html) - US phone number — `^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$` — (https://regexguide.com/patterns/us-phone.html) - US ABA routing number — `^\d{9}$` — (https://regexguide.com/patterns/us-routing-number.html) - US Social Security Number — `^(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}$` — (https://regexguide.com/patterns/us-ssn.html) - us-zip — `^\d{5}(-\d{4})?$` — (https://regexguide.com/patterns/us-zip.html) - Username — `^[a-zA-Z][a-zA-Z0-9_-]{2,19}$` — (https://regexguide.com/patterns/username.html) - UUID v4 specifically — `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$` — (https://regexguide.com/patterns/uuid-v4.html) - UUID / GUID — `^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$` — (https://regexguide.com/patterns/uuid.html) - Vietnam CCCD — `^\d{12}$` — (https://regexguide.com/patterns/vietnam-cccd.html) - Whitespace (multiple/leading/trailing) — `\s+` — (https://regexguide.com/patterns/whitespace.html) - Windows environment variable — `%([A-Za-z_][A-Za-z0-9_]*)%` — (https://regexguide.com/patterns/windows-env-var.html) - XML namespace declaration — `xmlns(:[a-zA-Z][\w-]*)?="[^"]*"` — (https://regexguide.com/patterns/xml-namespace.html) - YAML key — `^([a-zA-Z_][\w-]*)\s*:` — (https://regexguide.com/patterns/yaml-key.html) - YouTube video ID — `^[A-Za-z0-9_-]{11}$` — (https://regexguide.com/patterns/youtube-video-id.html)