安装在崇高的文本3 RegReplace插件,使文档中的一些变化。继文档创建搜索和替换的规则,但我提出几个问题,我不能找到解决方案。这些都是创建的规则。
{
"format": "3.0",
"replacements":
{
"cambio_afiliacion":
{
"find": "\\affil{([0-9,]*)}",
"replace": "<sup>\\1</sup>",
"greedy": true,
"greedy_scope": true
},
"cambio_section":
{
"find": "\\section{(.+?)}",
"replace": "<h3>\\1</h3>",
"greedy": true,
"greedy_scope": true
},
"cambio_href":
{
"find": "\\href{(.+?)}{(.+?)}",
"replace": "<a href=\"\\1\">\\2</a>",
"greedy": true,
"greedy_scope": true
},
}
}
这是您所创建的快捷方式在Default.sublime,键盘映射运行
{
"keys": ["ctrl+alt+j"],
"command": "reg_replace",
"args": {
"replacements": [
"cambio_afiliacion",
"cambio_href",
"cambio_section",
],
"find_only":false,
}
},
在文档中的要编辑的文字如下:
\href{google.com}{google.com}
Ivonne Narváez Zurita\affil{1}*
\section{Introducción}
当您执行快捷你只有做这样的变化
\<a href="google.com">google.com</a>
Ivonne Narváez Zurita\affil{1}*
\section{Introducción}
并且应该得到这样的结果
<a href="google.com">google.com</a>
Ivonne Narváez Zurita<sup>1</sup>*
<h3>Introducción</h3>
我找不到在哪里的错误可能不执行所有的替代品,并如图所示\href
从哪里获得\<a>
不正确的方式执行它们。
由于模式在设置JSON字符串被定义,你必须记住要正确定义逃逸。 \\a
将是相同\a
这是一个特殊的正则表达式逃逸。如果你想有一个文字\
,你必须躲避逃逸\\\\a
。这是一个间接的附加水平。你必须考虑到JSON字符串转义,和正则表达式逃逸。这很烦人,但只是它的方式使用崇高设置时是。
"cambio_afiliacion":
{
"find": "\\\\affil{([0-9,]*)}",
"replace": "<sup>\\1</sup>",
"greedy": true,
"greedy_scope": true
},
"cambio_section":
{
"find": "\\\\section{(.+?)}",
"replace": "<h3>\\1</h3>",
"greedy": true,
"greedy_scope": true
},
"cambio_href":
{
"find": "\\\\href{(.+?)}{(.+?)}",
"replace": "<a href=\"\\1\">\\2</a>",
"greedy": true,
"greedy_scope": true
},