[英]find some strings and replace another string using notepad++ regular expressions
In several Php Web Pages
, I'd like to add some extra html code
to an existing (and pre-existent) html code
. 在一些
Php Web Pages
,我想一些额外的添加html code
到现有(和预先存在) html code
。 For example I have: 例如,我有:
<a class="fix" name="P169336"> </a>
I'd like to use this example to replace another html code
which is located in other place of the same Web Page
. 我想使用此示例替换位于同一
Web Page
其他位置的另一个html code
。 For example I have: 例如,我有:
class="hyperlink">Alessandro Marinuzzi</a></td></tr>
So using the first (example) add to the second (example) as below: 因此,使用第一个(示例)添加到第二个(示例),如下所示:
class="hyperlink">Alessandro Marinuzzi</a><br /><br /><div class="srtgs" id="rt_169336"></div></td></tr>
Where rt_169336
is get from: rt_169336
的来源:
<a class="fix" name="P169336"> </a>
Every Web Page
has a own: 每个
Web Page
都有自己的:
<a class="fix" name="PXXXXXX"> </a>
You can find... 你可以找到...
<a class="fix" name="P169336"> </a>
or 要么
<a class="fix" name="P167223"> </a>
or another other number that changes for every Web Page
... 或其他每个
Web Page
都会更改的数字...
I'd like to do this replacement using the ability of notepad++
regular expressions
. 我想使用
notepad++
regular expressions
的功能进行此替换。 Any help is appreciated. 任何帮助表示赞赏。
Search for 搜索
(<A CLASS="fix" NAME="P)(\d+)("> </A>)(.*?)(Marinuzzi</A>)(</TD></TR>)
where 哪里
(<A CLASS="fix" NAME="P)
Group 1, data before the number (<A CLASS="fix" NAME="P)
组1,数据前的数据 (\\d+)
Group 2, the number (\\d+)
第2组,数字 ("> </A>)
Group 3, data after the number ("> </A>)
第3组,数字后面的数据 (.*?)
Group 4, data between search and replace sections (.*?)
组4,搜索和替换部分之间的数据 (Marinuzzi</A>)
Group 5, data before replace (Marinuzzi</A>)
第5组,替换前的数据 (</TD></TR>)
Group 6, data after replace (</TD></TR>)
组6,替换后的数据 And replace with 并替换为
\1\2\3\4\5<BR><BR><DIV CLASS="srtgs" ID="rt_\2"></DIV>\6
where 哪里
\\1\\2\\3\\4\\5
Reinsert groups 1-5 \\1\\2\\3\\4\\5
重新插入1-5组 <BR><BR><DIV CLASS="srtgs" ID="rt_\\2"></DIV>
insert new content with group 2 <BR><BR><DIV CLASS="srtgs" ID="rt_\\2"></DIV>
插入第2组的新内容 \\6
Reinsert group 6 \\6
重新插入第6组 Search mode must be Regular expression
with . matches newline
搜索模式必须是带有的
Regular expression
. matches newline
. matches newline
enabled. . matches newline
启用. matches newline
。
Note that this code assumes that search element is BEFORE the target element. 请注意,此代码假定search元素位于目标元素之前。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.