- 论坛徽章:
- 46
|
perlre 摘录(?(condition)yes-pattern|no-pattern)
(?(condition)yes-pattern)
Conditional expression. Matches yes-pattern if condition yields a true value, matches no-pattern otherwise. A missing pattern always matches.
Here's a summary of the possible predicates:
(1) (2) ...
Checks if the numbered capturing group has matched something.
(<NAME>) ('NAME')
Checks if a group with the given name has matched something.
(?=...) (?!...) (?<=...) (?<!...)
Checks whether the pattern matches (or does not match, for the '!' variants).
(?{ CODE })
Treats the return value of the code block as the condition. |
|