Regex.Matches: How to match a word in a string with a pattern consisting of thounds of words

As I want to fetch the City names from the contact data of many companies and there is no reliable selector or a clear structure of the contact data I have to come back to regex.
The pattern therefore ia city1|city2|…

Unfortunately only around 90 cities can be inserted to the regex.matches wizard.

So is there any possibility to to use something with the same function as the regex.matches but with thosunds of words?

@Tim_Gentemann
lets assume the CitiyNames for the pattern can be provided by Excel/DataTable/List/Array/textFile… so an implementation could look like this:

Example: DataTable:
grafik

testString:
grafik

grafik

Create an array from it
Produce the Pattern String
Execute the regex

ensure following:
grafik

find starter help here:
Match_AlternatesFromList.xaml (9.0 KB)

1 Like

Wow, thanks a lot!

I tried your workflow and it works fine. But as it writes all the results of course I needed the modification to only get the last match. (I noticed that the last match is the one I need in most cases)

So with Region=Matches.Last.toString my problem has been solved.

Without your help I would have needed long time, I think.

Best regards from Hannover to Munich :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.