Replacement structure

xiaoxiao2021-03-06  19

Replacement structure

The following table lists special characters for modifying regular expressions to allow one of the two / or matching.

Replace Construction Definition | Matching any term separated by a | (vertical bar) character; for example, CAT | DOG | TIGER. Use the leftmost success match. ("(Expression) YES | NO) If the expression matches this location, match the" YES "section; otherwise, match the" NO "section. "NO" section can be omitted. The expression can be any valid sub-expression, but it will become zero width assertions, so the syntax is equivalent to (? (? = Expression) YES | NO). Note that if the expression is the name of the naming group or the capture group number, the replacement structure will be interpreted as a capture test (described in this table). To avoid confusion in these cases, you can explicitly spell an internal (= expression). (? (Name) YES | NO) If the name capture string matches, match the "YES" section; otherwise, match the "NO" section. "NO" section can be omitted. If a given name does not correspond to the name or number of the capture group used in this expression, the replacement structure will be interpreted as an expression test (described in the previous form of this table).

See

Regular expression language elements

转载请注明原文地址:https://www.9cbs.com/read-42735.html

New Post(0)