Enter regular expression, attributes and string to show match,
optionally select which uses to show
Information
Regular Expressions
Character set: [ABC] = any character listed; [^abc] = not any character listed; [\w\W] = any character including newline; [A-Z] = range of characters
Escaped characters: \f = formfeed; \n = newline; \r = carriage return; \t = tab; \v = vertical tab; also those in regular expression syntax \ / [ - ] . ? * + { } ^ $ ( ) | for example \\
Metacharacters: \d = digit = [0-9]; \D = not digit; \s = single space (including \t etc); \S = not space; \w = letter, digit or underscore = [A-Za-z0-9_]; \W = not letter, digit or underscore; . = any character except newline
Position metacharacters: ^ = beginning of string or line; $ = end of string or line; \b = word boundary; \B = not word boundary (match no characters)
Grouping: (x) = groups content, may be nested and sets RegExp.$#, \# in regexp and $# in replacement counted by ( unless (?:x) = non capturing; | = alternatives
Replacement: $` = left context; $& = whole match; $# = #th capturing group; $' = right context
Assertions: look ahead x(?=y) = x if followed by y; x(?!y) = x if not followed by y; look behind (not all browsers) (?<=y)x = x preceded by y; (?<!y)x = x not preceded by y (only x is matched)
Counts of preceding character / group: ? = 0 or 1; * = 0 or more; + = 1 or more; {n} = exactly n times; {n,} = n or more times; {n,m} = at least n, at most m times; matching is greedy unless count followed by ?, eg, +?
Greediness: regular expressions match as much as possible in the string while the entire expression still matches unless counts are made lazy to match as little as possible by appending ?, eg, +?
Attributes
Attributes: g = global, i = case insensitive, m = multi-line, s = . matches newline
Context
Equivalents of deprecated static values are leftContext: str.substring(0, .index/.search), rightContext: (regexp+(.*)).exec[.length - 1]