[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}https?:\/\/(www\.)?[\w\-]+(\.[\w\-]+)+[\w\-.,@?^=%&:/~+#]*\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b(?:[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}:){0,5}[0-9a-fA-F]{1,4}#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})\b\b\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])\b\b(?:[01]\d|2[0-3]):[0-5]\d\b-?\b\d+\b-?\b\d+\.\d+\b\+?1?[\s.]?\(?\d{3}\)?[\s.\-]?\d{3}[\s.\-]?\d{4}\b\d{5}(?:-\d{4})?\b\b[a-zA-Z0-9_]{3,16}\b(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}<([a-zA-Z][a-zA-Z0-9]*)(?:\s[^>]*)?\s*\/?>[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]*\[([^\]]+)\]\(([^)]+)\)\b(\w+)\s+\1\b\s{2,}^\s*$A regular expression (regex) is a sequence of characters that defines a search pattern. They are used to match, locate, and manipulate text based on rules — from simple substring searches to complex structured extraction.
JavaScript regex syntax follows the ECMAScript standard, supporting character classes, quantifiers, anchors, groups, lookaheads, and named captures.
. — any character except newline\d \w \s — digit, word char, whitespace[abc] — character class; [^abc] negated^ $ — start / end of string (or line with m)* + ? — 0+, 1+, 0 or 1 occurrences{n,m} — between n and m repetitions(abc) — capturing group; (?:abc) non-capturing(?<name>abc) — named capturing groupg — global: find all matches, not just the firsti — case insensitive: A matches am — multiline: ^/$ match each line boundarys — dotAll: . also matches \nu — unicode: full Unicode support and strict mode$1, $2 — insert capture group 1, 2…$<name> — insert named capture group$& — insert the entire matched substring$` — insert the string before the match$' — insert the string after the match$$ — literal dollar sign