How to extract dynamic value from specific word in next line with Regex?

Hello Everyone, i want to extract below values marked in bold with regex code. It is 17 digit alphanumeric value. I tried with next line code but it select whole line but i want only 17 digit value
44 VIN 45 Expires 74 VIN 7S Expires
22 2HSCDAPN56C243417 02 22 JBDC4816357005593 03 22

44 VIN 4S Expires 74 VIN 7S Expires
JN8ASSMV6CW705344 - - 1N4BL3AP1EC180310 01 22

110 44 VIN 4S Expires 74 VIN 7S Expires
01 5FNRL386288097823 01 22 1HGCP2F76CA162594 09 21

44 VIN 4S Expires 74 VIN 7S Expires
01 L38RL36CA1809W703 01 22

Hi,

Can you try the following expression?

mc = System.Text.RegularExpressions.Regex.Matches(yourString,"\b[A-Za-z0-9]{17}\b")

note: mc is MatchCollection type.

Regards,

Thanks but not able to extract all values

Hi,

Which value did you fail to get?
can you check the following sample?

img20210729-2

Sequence3.xaml (5.9 KB)

Regards,

1 Like

It’s working now, thanks a lot.
any other regex code if i want to implement this in Matches activity or want to test on regexr.com \ regex101.com

Hi,

If the target string is always surrounded by whitespace, the following pattern also works, for example.

(?<=\s)[A-Za-z0-9]{17}(?=\s)

or simply \w might be used if there are no underscore or other characters of foreign language etc.

\b\w{17}\b

Regards,

1 Like

Thanks, working perfectly

1 Like

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