Skip to main content

QuantifierRegExp Syntax to express # repetitions to match

?

Optional RegExp Quantifier to match never or once

*

≥0 RegExp Quantifier to match zero or more

+

≥1 RegExp Quantifier to match 1+

{n}

RegExp Quantifier to match exactly n times

{n,}

RegExp Quantifier to match n or more times

{n,m}

RegExp Quantifier to match between n-m times

.*

RegExp Quantifier to match anything & everything

.*abc.*

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

^n

RegExp Quantifier to match n string at line begin

?=n

RegExp Quantifier to match string after n string

?!n

RegExp Quantifier to match string not after n string

References

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

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

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

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

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

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

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

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

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

  10. .*RegExp Quantifier to match anything & everything

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

  12. Reluctant ↔ behavior for Quantifier to match as few chars possible

  13. Greedy ↔ (default) behavior for Quantifier to match as many chars possible

  14. Lazy ↔ behavior for Quantifier to match once then stop