Not able to identify string because of multiple leading spaces


#1

Hi all,
I am trying to extract supervisor and employee names separated by colons in email.The issue is they were sometimes giving single space and some times multiple spaces after colon seperator.My workflow is working fine with single spaces and getting error for two spaces.

the expression iam using is:
System.Text.RegularExpressions.Regex.Match(item.Body,“Supervisor:[A-Z,a-z, ,]+”,System.Text.RegularExpressions.RegexOptions.CultureInvariant).Groups.Cast(Of System.Text.RegularExpressions.Group).Select(Function(item) item.Value.ToString).First.Split(":".ToCharArray)(1).Trim

error iam getting:
Capture


#2

Hi @vslp_uipc,

using regex replace is if multiple space to single space.
Pattern : \s+

Regex.Replace(value1, "\s+"," ")

Regards,
Arivu