Regular Expression for Number

I have an automation where i am reading through emails and getting a number. Below is an example of what i have to work with. Any idea how i would write the regular expression to pull the data after the : ?

  1. Equipment Serial Number: T27733333
  2. Equipment Serial Number: 09565
  3. Equipment Serial Number: T8992334
  4. Equipment Serial Number: HJYU678

Here is my code that im using now but its not pulling the number.
System.Text.RegularExpressions.Regex.Match(strBody,“(?<=Equipment Serial Number:?).*(?<= ‘/s’ )”).Value

You have use Matches activity as shown below…


StrCollection = System.Text.RegularExpressions.Regex.Matches("YourString","(?<=Equipment Serial Number:\s+)\w+")

Here StrCollection is of type MatchCollection

Then Use the strCollection in the for each to loop the values…

1 Like

As always Nice Work and thank you!!!

1 Like

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