Forum Academy Marketplace Showcase Pricing Features

Help on "Extract with regex" funcion

Dear Bubblers,
I need extract more than one strings of a description and create separated things for each one. See image attached the each string is highlighted on yellow.
REGEX
So I need to have five differents things for each yellow string.
Someone could help me on this issue?

Thanks a lot in advance!

André

So you need to split on @ and the get rid of commas and spaces, and ignore before the first @

The “Extract with regex” operator does not support capturing groups. It just returns the matches. So after playing around with positive look behinds on regex101 the following regular expression will return the list items: (?<[email protected])[^,]*. Breaking down the explanation in reverse order:

  • [^,]* match zero or more * characters [] that are not ^ commas ,
  • (?<[email protected]) and is (?) preceded <= by an at symbol @
1 Like

Exactly!!! :+1:

Thanks, I’ll try it.

is there a regex expression to extract alternate matches?

for example, original text 1,2,3,4,5,6,7,8

to extract 1,3,5,7
and separately 2,4,6,8

thank you

The key insight is that RegEx engines can only match a character once. Thus if we match pairs of items [^,]+,[^,]+ you can return either the first or second item. The difficulty is in handling lists with an odd number of elements. Liberally sprinkling non-capturing groups (?:...) we have.:

  • Odd items (?:([^,]+)(?:,[^,]+)?)
  • Even items (?:[^,]+(?:,([^,]+))?)

This topic was automatically closed after 70 days. New replies are no longer allowed.