Hello team ,
I have below examples of string :
PO Box : **32322 EG LM01
po BoX : 34243 ffafa
POBox 32323 sdfodah dada
DAJD Po box : 33122 sdfa
SAJDAH pO boX 424234 DSFS
I want to extract the ‘digits’ after ‘X’ where ‘x’ is the last letter of the word ‘box’
and x can be small or in caps.
so in the above cases i want to get 32322 , 34243 ,32323, 33122 , 424324
→ these digits or the number comes always after ‘x’ or ‘X’
→ i want to get the number till the " " (space) arrives - the number can be of any length . I want to extract the number.
Can you please help me in this string manipulation query?
Regards,
Gokul
sarathi125
(Parthasarathi)
May 10, 2022, 11:01am
2
@gokul1904 ,
Try with this regex \b\d{5,6}\b
sarathi125
(Parthasarathi)
May 10, 2022, 11:05am
3
@gokul1904 ,
If you need to do it without regex then you can do it with the below piece of code using Assign activity
String(yourInputString.Where(Char.IsDigit).ToArray())
1 Like
Hi @gokul1904 ,
You can Check with the Below Regex :
(?<=Box).*?(\d+)
We would require to take the Group 1 from the Matched Output.
Expression to be used will be like below :
System.Text.RegularExpressions.Regex.Match(yourInputString,"(?<=Box).*?(\d+)",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Groups(1).Value.ToString
1 Like
If you only want the number:
Use it with the Assign activity:
number = System.Text.RegularExpressions.Regex.Match(inputText, "(?i)(?<=x\D+)\d+").ToString
1 Like
gokul1904:
DAJD Po box : 33122 sdfa
thanks a lot ! - can you give me the portal link you used for regex validation?
Regards,
Gokul
@gokul1904 ,
Sure, Check the Below Link :
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
1 Like
thanks a lot ! this also works!
1 Like
system
(system)
Closed
May 13, 2022, 11:41am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.