PHP - Manual: Alternation and repetition
2024-11-13
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. |
官方地址:https://www.php.net/manual/en/parle.regex.alternation.php