正则表达式匹配以某字符串开始和结尾的字符串

前端之家收集整理的这篇文章主要介绍了正则表达式匹配以某字符串开始和结尾的字符串前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

今天在整理MvvmCross(c# mvvm跨平台框架)文档做epub电子书时,遇到到了文字显示不太好,需要去掉指定开头的字符串。

然后写了下面这个正则表达式

正则表达式

<a id="user.+</a>
可以匹配下面高亮这段文本

<h1 style="Box-sizing: border-Box; margin: 24px 0px 16px; line-height: 1.25; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(234,236,239); color: rgb(36,41,46); font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'; orphans: 2; widows: 2;"><a id="user-content-customizing-using-app-and-setup" class="anchor" href="https://github.com/MvvmCross/MvvmCross/blob/develop/docs/_documentation/fundamentals/Customizing-using-App-and-Setup.md#customizing-using-app-and-setup" aria-hidden="true" style="Box-sizing: border-Box; color: rgb(3,102,214); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"/></svg></a>Customizing using App and Setup</h1>

<p style="Box-sizing: border-Box; margin-top: 0px; margin-bottom: 16px; color: rgb(36,'Segoe UI Symbol'; font-size: 16px; orphans: 2; widows: 2;">In each deployed MvvmCross application there are two key classes which control how your app starts:</p>

原文链接:https://www.f2er.com/regex/358347.html

猜你在找的正则表达式相关文章