regex 积分运算器中的正则表达式

lf3rwulv  于 2022-12-14  发布在  其他
关注(0)|答案(2)|浏览(129)

IntegromatTextparser模块中,我得到了一个带有以下正则表达式的“无限循环”。
(?<=\n)(.*)(?=\nA|B)
我知道这是由于**|**,但不确定Integromat中的其他选项。

ej83mcc0

ej83mcc01#

在文本解析器模块中产生大量结果的原因可能是全局匹配设置为真,如下图所示设置为假,而你可能只从重新搜索中得到一个结果。

n3ipq98p

n3ipq98p2#

尝试以下模式

(?m)^(.+?)(?:\r?\nA|B)

说明

m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
^ asserts position at start of a line
1st Capturing Group (.+?)
  . matches any character (except for line terminators)
  +? matches the previous token between one and unlimited times, as few times as possible, expanding as needed (lazy)
Non-capturing group (?:\r?\nA|B)
  1st Alternative \r?\nA
  \r matches a carriage return (ASCII 13)
  ? matches the previous token between zero and one times, as many times as 
possible, giving back as needed (greedy)
  \n matches a line-feed (newline) character (ASCII 10)
A matches the character A with index 6510 (4116 or 1018) literally (case sensitive)
2nd Alternative B
  B matches the character B with index 6610 (4216 or 1028) literally (case sensitive)

相关问题