加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 06:04:59 所属栏目:百科 来源:网络整理
导读:当Oracle正则表达式不包含括号时,默认运算符优先级是多少? 例如,给定 H|ha+ 是否将其评价为H | h,然后连接到((H | h)a)中的a,或者H是否与(H |(ha))中的ha交替? 此外,什么时候开始等等? 解决方法 鉴于 Oracle doc: Table 4-2 lists the list of metachara
当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)相同.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读