我想准备正则表达式来匹配包含指定单词的段落(代理)。目前我的正则表达式匹配文本太早。我想我应该使用[^]不知何故,但我不知道如何。你能帮助我吗?
\n(\d+.\s+.?the Agency.?)(\n\d+.\s)(https://regex101.com/r/osJPVK/1)我要匹配从“3”.到“4.”的文本,因为它包含“the Agency”短语。
where sucts.
1. The objectives of the STh other arrangements are not inconsistent or in conflict with this licence
or the STC or other relevant statutory requirements.
3. The objectives of the STC referred to in sub-paragraph 1(c) are the:
(a) efficient discharge of the obligations imposed upon transmission licensees by
transmission licences and the Act;
(b) development, maintenance and operation of an efficient, economical consistent therewith) facilitating such competition in the sion Licence: Standard Conditions – 1 April 2022
91
(g) compliance with the Electricity Regulation and any relevant legally binding
decision of the European Commission and/or the Agency.
4. The STC shall provide for:
(a) there to be referred to the Authority for determination such matters arising under
the STC as may be specified in the STC;
(b) a copy of the STC or any part(s) thereof
\n(\d+.\s+.?代理商.?)(\n\d+.\s)(https://regex101.com/r/osJPVK/1)
1条答案
按热度按时间4c8rllxm1#
^\d+\.((?!^\d+\.).)*the Agency((?!^\d+\.).)*
^
只是说我们的匹配必须在一行的开头。棘手的是:
((?!^\d+\.).)*
:(?!...)
表示不要在下一个标记中查找标记...。下面是一个非常详细的答案。这里我们基本上是说在匹配中不要有任何行首后跟“\d+.”https://regex101.com/r/tW3SyX/1