emacs lisp 支持扩展正则表达式吗?

问题描述 投票:0回答:1

我尝试在 emacs lisp 中使用正则表达式分支,令我惊讶的是,它看起来只支持基本正则表达式,但文档没有明确提及。我想知道我是否做错了什么。

下面是我的测试,有证据表明 emacs lisp 不支持扩展正则表达式,并通过 grep 检查来证明我的正则表达式实际上可以在 emacs 之外工作。

Emacs

;; Using extended regular expressions
(string-match "(two|three)" "one, two, three, four, five") ;; result: NO match

;; Using basic regular expressions (no branches)
(string-match "two" "one, two, three, four, five") ;; result: match

重击

echo "one, two, three, four, five" | grep -E "(two|three)" # result: match
regex emacs lisp
1个回答
0
投票

就像我帖子的评论中提到的那样,答案在手册中:emacs lisp 支持扩展正则表达式吗?

© www.soinside.com 2019 - 2024. All rights reserved.