anjasing
(Anjali)
October 11, 2021, 9:45am
1
INC text size is same = 11 always,
but issue is it is retrieving anything starts with INC.
If anyone can suggest how to only retrieve INC succeeded with only digits i.e. INC12345678 from below body?
Please help!
I’ve used below code:
mailBody.substring(mailbody.indexOf(“INC”),11)
MailBody is below:
Hi,
abcdef
Regards,
Incidiya Arora
INC12345672
Regards,
Arora
Hi
We can try with Regex expression
To use this expression in UiPath use a assign activity like this
Let’s take you have the input in Strinput
Then in assign activity
Stroutput = System.Text.RegularExpressions.Regex.Match(Strinput.ToString,”(INC).+”).ToString
Cheers @anjasing
anjasing
(Anjali)
October 11, 2021, 9:49am
3
Are u sure it will take only 11 digits and will only INC succeeding with digits? Let me check
1 Like
If you want along with INC and the following digits then above expression
Or
If you want to have only the digit after INC
Then this expression
Stroutput = System.Text.RegularExpressions.Regex.Match(Strinput.ToString,”(INC).+”).ToString.Replace(“INC”,””)
Cheers @anjasing
1 Like
Hey @anjasing
This regex should slove your query: *\d{8}
System.Text.RegularExpressions.Regex.Match(Strinput.ToString,”*\d{8}”).ToString
Hope this helps
1 Like
ppr
(Peter Preuss)
October 11, 2021, 9:54am
6
in Addition to:
Palaniyappan:
If you want along with INC and the following digits then above expression
Or
If you want to have only the digit after INC
Then this expression
Stroutput = System.Text.RegularExpressions.Regex.Match(Strinput.ToString,”(INC).+”).ToString.Replace(“INC”,””)
Cheers @anjasing
And
let the string start by INC following by numbers and give try on following pattern
INC\d+
INC\d{8}\b
- restricting digits on a length of 8
(?<=INC)\d+
- Anchoring on INC and extracting only the number
1 Like
anjasing
(Anjali)
October 11, 2021, 10:07am
7
ppr:
INC\d{8}\b
This worked INC\d{8}\b and was a small solution. Thank you so much,
Thank you all for your help
system
(system)
Closed
October 14, 2021, 10:07am
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.