Regular Expressions 101

Community Patterns

if, ternary

0

Regular Expression
PCRE (PHP <7.3)

/
<if (?'name'\w+)(?'op'[=!<>][=]?)(?'value'.+?)>(?'true'.+?)(?:<else>(?'false'.*))?<\/if>
/
gs

Description

Prints a statement if expression evaluates to true, otherwise prints an alternative expression

Submitted by anonymous - 4 years ago