搜索并替换为通配符和换行符 [英] Search and replace with wildcard and line break

查看:237
本文介绍了搜索并替换为通配符和换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试匹配每页的第一行(假设它是我特定文档中的标题),并将换行符替换为段落符. 理想情况下,我试图做类似的事情

I'm trying to match the first line of each page (assuming it is a title in my specific doc) and replace the line break with a paragraph break. Ideally I tried to do something like

(^m)(*)(^l) 

搜索和

\1\2^p

在替换框中.

除了其他语法错误外,它不起作用的主要原因是启用通配符会阻止匹配特殊字符.我不完全了解底线以及如何克服这种局限性.关键是我确实要匹配一个分页符,然后是多个字符,并以换行符终止.

Aside from other syntax mistakes, the main reason why it doesn't work is that enabling wildcard prevents from matching special characters. I don't fully understand the bottom line and how to overcome such limitation. The point being that I want to match a page break, followed by a number of chars and terminated by a line break, indeed.

推荐答案

好,我已经找到了解决方法

Ok, I've found how to do that

Find text (^m*)^l
Replace text \1^p 

显然我的问题中的代码也适用.

apparently the code in my question works too.

我感到困惑的是,只有 ^p在带有通配符的查找文本"中不被接受,而必须由^13代替.

I was confused by the fact that only ^p is not accepted in the "find text" with wildcard and must be replaced by ^13.

这篇关于搜索并替换为通配符和换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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