搜索字符串后跟行尾 [英] Search a string followed by an end of line

查看:107
本文介绍了搜索字符串后跟行尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Emacs 中,我使用 Ctrl + s 来浏览文本中的字符串。



现在,我对字符串 abc 感兴趣,只有当它在一行结束时。我们可以这样说,一个字符串 abc ,后面是一行。



有谁知道如何在 Emacs 中搜索?

解决方案

CMs abc $ p>

CMs 调用 isearch-forward-regexp



如果您在意识到需要正则表达式搜索之前已经输入了 Cs abc ,只需输入< kbd> Mr ,isearch将切换到使用正则表达式。



或者,您可以(在大多数情况下)使用:

Cs abc Cq Cj



由于 Cq Cj 是在搜索模式中键入换行符的方式(作为 quoted-insert Cj )。


In Emacs, I use Ctrl+s to go through a string in a text.

Now, I am interested in a string abc, only when it is in the end of a line. We can say alternatively, a string abc which follows by an end of line.

Does anyone know how can I search that in Emacs?

解决方案

C-M-s abc$

C-M-s calls isearch-forward-regexp

If you've already typed C-s abc before realising you need a regexp search, just type M-r and isearch will switch to using regexps.

Alternatively, you could (in the majority of cases) use:
C-s abc C-qC-j

As C-qC-j is the way to type a newline character into the search pattern (being a quoted-insert of C-j).

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

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