如何使用RegEx替换Notepad ++中的HTML代码 [英] How can I replace HTML code in Notepad++ using RegEx

查看:86
本文介绍了如何使用RegEx替换Notepad ++中的HTML代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多php页面。每个php页面都有一个这样的字符串:

 < FONT COLOR =#0000FF>发布ID:16107< / FONT> 

我想用以下内容替换:

 < A HREF =#16107>发帖ID:16107< / A> 

但是由于每个php页面都有不同的Post ID,我想匹配每个出现的字符串......我通常使用notepad2女巫支持正则表达式和记事本+ +也支持正则表达式。我怎样才能将所有字符串替换为所有文件夹中的所有文件?大约350个文件...

解决方案

替换: < FONT COLOR =。*?>(Post ID:([0-9] +))< / FONT> $ b

< A HREF =#\2> \1< / A>


I have a lot of php pages. Every php page has inside a string like this:

<FONT COLOR="#0000FF">Post ID: 16107</FONT>

and I'd like to replace with:

<A HREF="#16107">Post ID: 16107</A>

but since every php page has a different Post ID and I'd like to match every occurrence of the string... I use as usually notepad2 witch supports regex and notepad++ too that supports regex as well. How can I replace all strings into all files into all dirs? Are about 350 files...

解决方案

Replace: <FONT COLOR=".*?">(Post ID: ([0-9]+))</FONT>

With: <A HREF="#\2">\1</A>

这篇关于如何使用RegEx替换Notepad ++中的HTML代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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