Capture numbers that start and end with certain digits

Good afternoon friends;

A query please, I want to capture all the account numbers that start with 411 and end with 77, but on some occasions it appears with the (-)

411-5863785-0-77
4115863785077

Some simple regex will do like ^(411(.*)77), you can implement it with Matches/Is Match activities

image

Hey @Lynx

Try this pattern.

Then use an assign activity with the following:

system.Text.RegularExpressions.Regex.Match(INSERTxlNPUTxSTRINGxVARIABLE,
‘’^411[\d-]+77").ToString

Hopefully this helps.

Cheers

Steve

1 Like

Thank you @Steven_McKeering :slight_smile:

Hey @lynx

Nothing wrong with the pattern from @Edwin_Barahona. My pattern is basically the same just a little bit more implicit.

But you did have the wrong numbers in your screenshot.

You had 191 instead 411 at the start of the pattern.

You should consider marking his reply as solution :blush:

Cheers

Steve

1 Like

It’s true, you’re right, the mistake was mine, @Edwin_Barahona regex was fine too :slight_smile:

Thank you very much to both

1 Like

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