正则表达式 – 正则表达式中的运算符优先级

前端之家收集整理的这篇文章主要介绍了正则表达式 – 正则表达式中的运算符优先级前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当Oracle正则表达式不包含括号时,默认运算符优先级是多少?

例如,给定

H|ha+

是否将其评价为H | h,然后连接到((H | h)a)中的a,或者H是否与(H |(ha))中的ha交替?

此外,什么时候开始等等?

解决方法

鉴于 Oracle doc

Table 4-2 lists the list of Metacharacters supported for use in regular expressions passed to sql regular expression functions and conditions. These Metacharacters conform to the POSIX standard; any differences in behavior from the standard are noted in the “Description” column.

并看看|该表中的值:

The expression a|b matches character a or character b.

加上看看POSIX doc

Operator precedence
The order of precedence for of operators is as follows:

  1. Collation-related bracket symbols [==] [::] [..]

  2. Escaped characters \

  3. Character set (bracket expression) []

  4. Grouping ()

  5. Single-character-ERE duplication * + ? {m,n}

  6. Concatenation

  7. Anchoring ^$

  8. Alternation |

我会说H | ha与(?:H | ha)相同.

猜你在找的正则表达式相关文章