我有数百个列表项要编码。 每个列表项包含 2 行的标题和说明。 所以我需要做的是用标签包装 2 行。 有没有办法使用崇高文本 2 做到这一点? 我正在使用Windows操作系统。
这是所需的输出:
<ul>
<li>
this is the title
this is the descrpition
</li>
<li>
this is the title
this is the descrpition
</li>
</ul>
原始文本如下所示:
这是标题
这是描述
这是标题
这是描述
==
我尝试使用 ctrl+shift+G 并使用 ul>li*,但不幸的是,它用<li>
包裹每一行
如果可能使用崇高的文本,我实际上需要这种类型的结构:
<ul>
<li>
<span class="title">this is the title</span>
<span class="description">this is the descrpition</span>
</li>
<li>
<span class="title">this is the title</span>
<span class="description">this is the descrpition</span>
</li>
</ul>
使用查找和替换的两步过程怎么样?
我假设:
- 您的原始文本根本没有缩进;
- 您的缩进是两个空格;和
- 完成后,您将使用
<ul>
和由此产生的缩进自行处理包装。
原始状态:
this is title
this is description
this is title
this is description
第一步
确保已启用正则表达式匹配,请使用这些值进行查找和替换。
查找内容 :: ((.*n){1,2})
替换为 :: <li>n1</li>n
结果:
<li>
this is title
this is description
</li>
<li>
this is title
this is description
</li>
第二步
确保已启用正则表达式匹配,请使用这些值进行查找和替换。
查找内容 :: (<li>n)(.*)n(.*)
替换为 :: 1 <span class="title">2</span>n <span class="description">3</span>
结果:
<li>
<span class="title">this is title</span>
<span class="description">this is description</span>
</li>
<li>
<span class="title">this is title</span>
<span class="description">this is description</span>
</li>
你觉得怎么样?
足够接近有用吗?