【发布时间】:2013-07-30 19:27:53
【问题描述】:
为令人困惑的标题提前道歉。我的问题如下,我在大约 600 个文件中有以下文本:
$_REQUEST['FOO']
我想用以下内容替换它:
$this->input->post('FOO')
为了澄清,我匹配以下内容:
$_REQUEST any number of A-Za-z\d followed by a ]
并将其替换为:
$this->input->post( the alphanumeric word from above followed by a )
或者一般来说:
Anchor token TEXT TO KEEP end anchor token
这与标准查找/替换不同,因为我想将文本保留在两个单词边界内。
此功能是否存在于任何文本编辑器(Eclipse、np++ 等)中。还是我需要编写某种程序来解析这 600 个文件来进行替换?
【问题讨论】:
标签: regex text language-agnostic replace