Skip to main content

Trying to compare two columns that have strings concatenated by ' | ' and look like this:

 

COL A

abc | def | ghi

 

COL B

abc | xyz

 

Desired result:

COL C that contains the matching part of both strings.

 

In this case result should be: abc

 

COL D containing the count of matched parts of the string.

 

In this case, result should be: 1

 

Would appreciate your response.

 

I think if you use a StingSearcher on COL A with COL B ​as the reg-ex to match and set to match all and create a list. This should give you the number of matches (COL D) as well as a list full of matches. Next use a ListConcatonator to squash the list into a single attribute (COL C) you can specify the delimiter for the attribute e.g., |

Let us know how you get on​


Thanks for your reply. So, I tried the StringSearcher but it only outputs the first match. How do I change it to match all? And I'm still not sure how to get number of matches from this transformer.


Thanks for your reply. So, I tried the StringSearcher but it only outputs the first match. How do I change it to match all? And I'm still not sure how to get number of matches from this transformer.

You will have to specify a list name. It will still output the first matched as attribute but there should also be a list attribute generated with matches. If the number of matches is not given you can use a listElementCounter to get the number​


Reply