且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Emacs发生模式搜索多个字符串

更新时间:2023-02-12 19:37:02

您可以传递一个正则表达式, $ c>发生字符串到。例如,键入 Mx 发生 RET DEBUG\ | ERROR


I have a plain text file with multiple patterns. Example:

DEBUG: i'm a debug line
DEBUG: Another 1
ERROR: this was an error
DEBUG: Another 2
NORMAL: EMACS
DEBUG: Another 3
ERROR: another error

The idea is to use occur-mode to filter the text file with the patterns i want.
Example: DEBUG and ERROR.

As far as i understood occur only works with single string entry or regex.
How can i use the occur mode to filter more than one string pattern ? If there is another emacs mode to filter strings in text i also accept.

You can pass a regexp that matches either of the strings to occur. E.g., type M-x occur RET DEBUG\|ERROR.