我正在寻找将我的正则表达式与可能在前面包含标题的 HTML 字符串进行匹配。字符串的模式将是这样的:
This Is the Title Using Title Case <br/> This is the rest of the sentences using regular sentence case.
我想在一开始就抓住标题,但是我在考虑其中包含的小写文章和共轭时遇到了麻烦。我设法为纯标题案例找到了一些有用的代码:
([A-Z][\w-]*(?:\s+[A-Z][\w-]*)+ <br/>)
但我不知道如何构造它以包含以下小写版本:
(a|an|the|and|but|or|on|in|with)