Skip to main content

Hi,

I'm using the string searcher to extract some codes out of a text field. I can extract the first match or build al list with all the matches but is it also possible to extract only the second match of the third match?

This in an example of the text. When it says "2 opladingen" then I need the first two codes that are in the parentheses, but they can't be in the same field as I have yet to join them with another table. I already found the right expression to find the codes \\d{3}[_][A-Z]{3,}

 

Er ontbreken nog 2 opladingen voor aanleveringsgebieden: (ZG Beveren aan de Ijzer (rietveld VLM): AQUAFIN (556_AQUAFIN), ZG Beveren aan de Ijzer (rietveld VLM): INTERCOMMUNALE WATERLEIDINGSMAATSCHAPPIJ VAN VEURNE AMBACHT (556_IWVA))<br/>Een inactief gebied mag geen data meer bevatten (ZG Beveren aan de Ijzer (rietveld VLM): VLAAMSE MILIEUMAATSCHAPPIJ (556_VMM) -> Bewerking: p: 1, s: 0, i: 0)<br/>

I don't think that's going to be possible with an "easy" Regex and since you already have a list of matches my recommendation would be to use that.


@nath​ I think two string searchers will help you get going. The first StringSearcher to find the position of "2 opladingen" . This will return a list of all occurrences plus start index.

dialog 

then the second StringSearcher: Add parenthesis to your regex to create a capture group around your code: (\\d{3})<_]>A-Z]{3,}

Then again, under advanced create a list of the subexpression you just captured:

dialog1You get a list of all occurences of the code and the start indices:

dialog2You should be able to compare the two sets of results to get the codes you need.


Reply