🔰repeat

🚧 under construction

JSvalueobjectregexpattern ⟩ repeat

         repeat   regex       matches
------------------------------------------------------
?	 0 ~ 1    colou?r     color colour
*        0 ~ ∞    b\w*        b be bee beer beers
+        1 ~ ∞    b\w+        be bee beer beers

{2,3}    2 ~ 3    b\w{2,3}    bee beer beers
{3}      3
{3,}     3 ~ ∞

// quantifiers are normally greedy (match as much as possible)
// when followed by ? they become lazy (match as little as possible)
+?       lazy     b\w+?       be bee beer beers         (as few as possible)
                              ╰╯ ╰╯  ╰╯   ╰╯

🈯 synonyms: "quantifier", "repetition operator"

When using a repetition operator, consider the lazy variant first.

Last updated