Skip to main content

RegExpregex Global Object to make Regular Expressions in JS

RegExp()

Constructor Function for new RegExp Object

Source: developer.mozilla.org/en

RegExp Syntax

JS-specific regex syntax

Regexp Snippets

[<span data-tooltip-id="preview__8xougBuxfkTpodRoj">RegExp()</span>](regexp_regexp) [<span data-tooltip-id="preview__5u877wnW7hxo7TDL3">Instance Method</span>](instance-method)

References

  1. RegExp()Constructor Function for new RegExp Object

  2. RegExp Literal NotationLiteral JS Syntax to create RegExp, execute at Compile Time

const re = /pattern/flags;
  1. regexp atom ↔ basic building block of RegExp

  2. y ↔ stickY RegExp Flag to set no characters between matches

  3. \nRegExp Control Character Escape for New line feed (LF) character

  4. \fRegExp Control Character Escape for Form feed (FF) character

  5. \rRegExp Control Character Escape for carriage Return (CR) character

  6. \tRegExp Control Character Escape for Tab character

  7. \vRegExp Control Character Escape for vertical line tabulation

  8. \cARegExp Arbitrary Character Escape for Ctrl+A

  9. \cZRegExp Arbitrary Character Escape for Ctrl+Z

  10. RegExp Constructor NotationRegExp Syntax to call RegExp() to execute RegExp expression at Runtime

const re = new RegExp(_regExpPattern: RegExp, flags = regExp.flags)
  1. Flag ↔ optional modifier for RegExp to config how Assertion behave on patterns

  2. [^abc]RegExp Negated Character Class to NOT match chars abc in bracket

  3. [0-9]RegExp Character Class to match digit range from 0-9

  4. [A-z]RegExp Character Class to match letter range (a-z & A-Z)

  5. [:punct:]RegExp Character Class to match punctuation char

  6. [:space:]RegExp Character Class to match space char

  7. GroupRegExp JS Syntax using () to group together RegExp expressions

  8. [:blank:]RegExp Character Class to match space or tab char

  9. ^[abc]RegExp Character Class to match at line start char

  10. ? ↔ Optional RegExp Quantifier to match never or once

  11. *≥0 RegExp Quantifier to match zero or more

  12. + ↔ ≥1 RegExp Quantifier to match 1+

  13. .*abc.*RegExp Quantifier to match any phrase contains abc between anything/nothing

  14. {n}RegExp Quantifier to match exactly n times

  15. {n,}RegExp Quantifier to match n or more times

  16. ^RegExp Assertion to negate Character Class or only match start of line

  17. $RegExp Assertion to match n expression at end of line

  18. {n,m}RegExp Quantifier to match between n-m times

  19. .*RegExp Quantifier to match anything & everything

  20. ^nRegExp Quantifier to match n string at line begin

  21. ?=nRegExp Quantifier to match string after n string

  22. ?!nRegExp Quantifier to match string not after n string

  23. |RegExp Assertion OR operator for alternative characters/expressions

  24. \bRegExp Assertion to match only at boundary of word (beginning or end of word)

  25. \B ↔ inverted RegExp Assertion to match only at not boundary of word (beginning or end of word)

  26. uFlag to set RegExp Pattern Character as Unicode

  27. \nRegExp back ref to numbered Capture Group

  28. Metacharacter\ ^ $ . * + ? ( ) [ ] { } | special reserved RegExp character with special (non-literal) meaning to define search criteria/manipulation

  29. excludeStories ↔ to set mocked state data as non-story export, via string[] || RegExp

  30. regexp **body** ↔ of RegExp expression (abc) inside /abc/