Regex in Integromat

1.8k Views Asked by At

I am getting an 'infinite loop' with the below regex expression in the Textparser module in Integromat.

(?<=\n)(.*)(?=\nA|B)

I know it is due to the | , but unsure the other options in Integromat.

2

There are 2 best solutions below

0
On BEST ANSWER

Try the pattern like

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

EXPLANATION

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)
0
On

the cause of a lot of results in the Text Parser module could be that the Global Match is set to true, set to false like in the below picture and you may ge just one result from your regrex.

enter image description here