当模式(不)包含带括号的组时,为什么expr匹配输出不同的东西?

Ank*_*wal 3 regex linux bash pattern-matching

为什么

$ echo `expr match abcdef 'abc'`
Run Code Online (Sandbox Code Playgroud)

给出匹配的字符数,即3

$ echo `expr match abcdef '\(abc\)'`
Run Code Online (Sandbox Code Playgroud)

给出匹配的字符,这是abc吗?

我理解正则表达式匹配在这里发挥作用,但是无法理解括号中的子表达式如何在这里产生这种差异?

Pri*_*gar 7

这是来自expr的手册页:

Pattern matches return the string matched between \( and \) or null; if \( and \) are not used, they return the number of characters matched or 0.

手册页.