Regular expression priority

xiaoxiao2021-03-06  90

Regular expressions are calculated from left to right and follow priority order, which is very similar to the arithmetic expression.

The following table has a priority order of various regular expression operators from the highest to minimum:

Operator Description / Essential (), (? :), (? =), [] Brackets and middle brackets *, ,?, {N}, {n,}, {n, m} definition ^, $, / Anymetachacter, AnyCharacter Location Point and Sequence | Replacement

The priority of characters is higher than that of the replacement operator, and the alternative operator allows "M | Food" to match "M" or "Food". To match "Mood" or "Food", use parentheses to create sub-expressions to generate "(m | f) OOD."

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

New Post(0)