Need Regex for the text

Hi,

Need to know regex to get Project ID. Below is text I want the project ID that A01X7Z1 in future it would be of 5 digit 6 digit or might be 7 or 8. Please help me out in getting project id

Hello,

Project: A01X7Z1 is Ready for Batching.

Thank You

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Match(text,"(?<=Project:\s*)\S+").Value

Regards,

1 Like

Hi,

You need to set Final as String type because your project Id is not integer (Int32) as “A01X7Z1”.

Regards,

That error is occurring because your variable called “Final” is of type integer, but the RegexMatch.Value returns a string.

Either change the “final” integer to be of type string, or wrap the right side of an assign with a CInt() which converts the string to integer.

Thanks
It showing blank

Hi,

Can you try the following? Probably you can extract project ID from mail body directly.

System.Text.RegularExpressions.Regex.Match(Body,"(?<=Project:\s*)\S+").Value

Regards,

1 Like

Thanks its working

2 Likes

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