I want to get Work request number and ticket number using regex. please help

You have been awarded Work Request : 05958891.
Ticket Number : CNR2208169.
Please consult the ACAS System for details.

we can anchor the regex
grafik
similar we can do for the ticket
grafik

System.Text.RegularExpressions.Regex.Match(MailSubject,"(?<= Work Request:)"/d+).Value
but its showing error.

you are not using backslash d and also do end the string quotation not on end of pattern string

Please use the right syntax as shown above

Sorry for bothering. Please correct me with correct syntax
System.Text.RegularExpressions.Regex.Match(MailSubject,"(?<=Work Request:)(\d+,*).Value.ToString

Thanks in advance

(?<=Work Request : )\d+

System.Text.RegularExpressions.Regex.Match(YourStringVar,"(?<=Work Request : )\d+").Value.ToString

Hi @Puneet_Singh3

Here is the expression for Work Request

Use Assign Activity
LHS - Create an avriable
RHS - System.Text.RegularExpressions.Regex.Match(MailSubject,"(?<=Work Request : )\d+").Tostring

Here is the expression for Ticket Number

Use Assign Activity
LHS - Create an avriable
RHS - System.Text.RegularExpressions.Regex.Match(MailSubject,"(?<=Ticket Number : )\w+").Tostring

For More Information Refer the thread

Regards
Gokul

Getting Blank in message box

Can you share the Exact Input in preserver format @Puneet_Singh3

Hi @Puneet_Singh3

Here is the expression for Work Request

Try this expression

Use Assign Activity
LHS - Create an avriable
RHS - System.Text.RegularExpressions.Regex.Match(MailSubject,"(?<=Work Request)\s+\d+").Tostring.Trim

Here is the expression for Ticket Number

Try this expression

Use Assign Activity
LHS - Create an variable
RHS - System.Text.RegularExpressions.Regex.Match(MailSubject,"((?<=Ticket#)\s+\w+").Tostring.Trim

Regards
Gokul

1 Like

Work Request is working fine but getting issue in Ticket on Issue is ""Assign: parsing β€œ((?<=Ticket#)\s+\w+” - Not enough )'s.

String is You have been awarded Work Request 05958948, Ticket# CSR2209549. Please consult the ACAS System for details.

Hi @Puneet_Singh3

Try this expression

Use Assign Activity
LHS - Create an variable
RHS - System.Text.RegularExpressions.Regex.Match(MailSubject,"(?<=Ticket#)\s+\S+").Tostring.Trim

Regards
Gokul

1 Like

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