时间:2021-05-22
待替换的文本:
复制代码代码如下:
<link rel="stylesheet" title="Default" href="styles/default.css">
<link rel="alternate stylesheet" title="Dark" href="styles/dark.css">
<link rel="alternate stylesheet" title="FAR" href="styles/far.css">
<link rel="alternate stylesheet" title="IDEA" href="styles/idea.css">
<link rel="alternate stylesheet" title="Sunburst" href="styles/sunburst.css">
<link rel="alternate stylesheet" title="Zenburn" href="styles/zenburn.css">
<link rel="alternate stylesheet" title="Visual Studio" href="styles/vs.css">
<link rel="alternate stylesheet" title="Ascetic" href="styles/ascetic.css">
<link rel="alternate stylesheet" title="Magula" href="styles/magula.css">
<link rel="alternate stylesheet" title="GitHub" href="styles/github.css">
<link rel="alternate stylesheet" title="Google Code" href="styles/googlecode.css">
<link rel="alternate stylesheet" title="Brown Paper" href="styles/brown_paper.css">
<link rel="alternate stylesheet" title="School Book" href="styles/school_book.css">
<link rel="alternate stylesheet" title="IR Black" href="styles/ir_black.css">
<link rel="alternate stylesheet" title="Solarized - Dark" href="styles/solarized_dark.css">
<link rel="alternate stylesheet" title="Solarized - Light" href="styles/solarized_light.css">
<link rel="alternate stylesheet" title="Arta" href="styles/arta.css">
<link rel="alternate stylesheet" title="Monokai" href="styles/monokai.css">
<link rel="alternate stylesheet" title="XCode" href="styles/xcode.css">
<link rel="alternate stylesheet" title="Pojoaque" href="styles/pojoaque.css">
<link rel="alternate stylesheet" title="Rainbow" href="styles/rainbow.css">
<link rel="alternate stylesheet" title="Tomorrow" href="styles/tomorrow.css">
<link rel="alternate stylesheet" title="Tomorrow Night" href="styles/tomorrow-night.css">
<link rel="alternate stylesheet" title="Tomorrow Night Bright" href="styles/tomorrow-night-bright.css">
<link rel="alternate stylesheet" title="Tomorrow Night Blue" href="styles/tomorrow-night-blue.css">
<link rel="alternate stylesheet" title="Tomorrow Night Eighties" href="styles/tomorrow-night-eighties.css">
想要的格式如下:
索引 = 内容
其中,索引为 href属性中的css文件名(不含扩展名),内容为 title属性。如果普通替换,可以得到内容 = 索引 格式的结果,可是剩下的就得手动替换了。
用正则表达式,一步就可以搞定,正则式为:
复制代码代码如下:
.+=\".+\".+=\"(.+)\".+=\"\w+\/(.+)[.].+
替换规则:
复制代码代码如下:
\2 = \1
替换后结果:
复制代码代码如下:
default = Default
dark = Dark
far = FAR
idea = IDEA
sunburst = Sunburst
zenburn = Zenburn
vs = Visual Studio
ascetic = Ascetic
magula = Magula
github = GitHub
googlecode = Google Code
brown_paper = Brown Paper
school_book = School Book
ir_black = IR Black
solarized_dark = Solarized - Dark
solarized_light = Solarized - Light
arta = Arta
monokai = Monokai
xcode = XCode
pojoaque = Pojoaque
rainbow = Rainbow
tomorrow = Tomorrow
tomorrow-night = Tomorrow Night
tomorrow-night-bright = Tomorrow Night Bright
tomorrow-night-blue = Tomorrow Night Blue
tomorrow-night-eighties = Tomorrow Night Eighties
来自:annhe.net
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
正则表达式replace()函数:此函数用指定的字符串替换字符串中与正则表达式匹配的子字符串。返回值是一个替换后的新字符串。这里只介绍正则表达式的相关操作,其他
可能在dw中使用正则表达式替换字符串的朋友很少但,其实我们可以使用正则表达式替换href中的内容,该怎么使用正则表达式呢?下面我们就来看看详细的教程。软件名称:
正则表达式概述正则表达式在程序设计语言中存在着广泛的应用,特别是用来处理字符串。如匹配字符串、查找字符串、替换字符串等。可以说,正则表达式是一段文本或一个公式,
正则表达式概述正则表达式在程序设计语言中存在着广泛的应用,特别是用来处理字符串。如匹配字符串、查找字符串、替换字符串等。可以说,正则表达式是一段文本或一个公式,
1.字符串中的正则表达式使用正则表达式可以对字符串进行查找、提取、分割、替换等操作。String类当中提供了如下几个特殊方法:booleanmatches(St