Emacs发生模式搜索多个字符串 [英] Emacs occur mode search for multiple strings

查看:170
本文介绍了Emacs发生模式搜索多个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个模式的纯文本文件。例如:


DEBUG:我是一个调试行

DEBUG:另一个

错误:这是一个错误

DEBUG:另外2个

NORMAL:EMACS

DEBUG:另外3个

错误:另一个错误< br>


想法是使用发生模式来使用我想要的模式过滤文本文件。
示例:DEBUG和ERROR。



据我所知,发生只适用于单个字符串条目或正则表达式。

如何使用发生模式过滤多个字符串模式?如果有另一种emacs模式来对文本中的字符串进行过滤,我也接受。

解决方案

您可以传递一个正则表达式, 发生字符串到。例如,键入 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.

这篇关于Emacs发生模式搜索多个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆