Emacs rx 语义

Emacs rx 语义

我使用 rx.el 模块构建了以下正则表达式

   (rx (and bol (0+ (not (any "#" "[]*" "\n")))  " " (or "#" "[]*") " "))

我想将字符串 []* 更改为字符串 ~=[,,_,,]:3 但是当我写下以下内容时

(rx (and bol
             (0+ (not (any "#" "~=[,,_,,]:3" "\n")))
             " "
             (or "#" "~=[,,_,,]:3")
             " "))

rxt-explain 表明它被编译为错误的正则表达式

(sequence line-start
          (zero-or-more
           (not
            (any "~" "[" ":" "," "\n" "]" "#" "3" "=" "_")))
          " "
          (or
           (any "#")
           "~=[,,_,,]:3")
          " ")

关于如何修复正则表达式以便将“~[,,_,,]:3”视为一个组,有什么想法吗?

相关内容