Match activity

Input string = 0011198580076 + 0810079119023 + 0147326390061

Output array of items who are exactly 13 numbers so in this case 3

I’m using the match activity but only get the first hit.

image

How do i get the other 2 or maybe 10 for that mather?

Your pattern is wrong. The ‘^’ indicates that it’s at the beginning of the string, so it only looks for 13 digits that is the start of the string.

You should probably use an OR with ‘|’ to look for whitespace or beginning

Pattern: "(^|(?<=\s))\d{13}"

Hopefully I did that right :smiley:

Regards.

1 Like

@ClaytonM is correct, your pattern is only searching the beginning. I would alter your pattern so it is searching for the beginning of the input OR whitespace before the 13 digit number, but I would also make sure it is searching for the end of the input or whitespace after the 13 digit number as well. Therefore the regex pattern should be: (?<=\s|^)\d{13}(?=\s|$)

If you don’t do that, then regex will still find matches for any number that is greater than 13 digits :slight_smile:

EDIT: I’d recommend testing any regex patterns at this site which is a VB.NET specific regex tester: http://regexstorm.net/tester - I tested the pattern above with the following input and it returned 3 matches: 0011198580076 + 0810079119023 + 0147326390061 + 12345678901234

1 Like