parle-php-regex-php-alternation-8

  • Pattern matching
  • Alternation and repetition

  • Alternation and repetition
  • Alternation and repetition

    Alternation and repetition

    Alternation and repetition
    Sequence Greedy Description
    …|… Try subpatterns in alternation.
    * yes Match 0 or more times.
    + yes Match 1 or more times.
    ? yes Match 0 or 1 times.
    {n} no Match exactly n times.
    {n,} yes Match at least n times.
    {n,m} yes Match at least n times but no more than m times.
    *? no Match 0 or more times.
    +? no Match 1 or more times.
    ?? no Match 0 or 1 times.
    {n,}? no Match at least n times.
    {n,m}? no Match at least n times but no more than m times.
    {MACRO} Include the regex MACRO in the current regex.