Help me to create regex to only get numbers

You want only 8515 value or anything more @StevenIsRobotOnline

i want to get the numbers only based on those use cases pattern if possibile

Okay Got it @StevenIsRobotOnline

=> Assign -> StrOutput = System.Text.RegularExpressions.Regex.Match(StrVar.ToString,β€œ((?<=(^[A-Z]+\s+[A-Z]+)|([A-Z]+\s+[A-Z]+)|[A-Z]+\s+[A-Z]+\s+|[A-Z]+\s+[A-Z]+\-)\d+)”).Value

It’s working as expected check now




Hi Thanks for the hel but it still wont work properly on some of my use cases

1.WILDUN DUMA 8515 β†’ 8515
2.WILWAL SE1865 GEN+ Feed, Food (N570) - >570
3.WILWAL AI1865 GEN+ Feed, Food (N570) ->570

thank you



1 Like

Okay @StevenIsRobotOnline

Use the below one

=> Assign -> StrOutput = System.Text.RegularExpressions.Regex.Match(StrVar.ToString,β€œ((?<=(^[A-Z]+\s+[A-Z]+)|([A-Z]+\s+[A-Z]+)|[A-Z]+\s+[A-Z]+\s+|[A-Z]+\s+[A-Z]+\-)\d+)|(?<=[A-Z]+)\d+(?=[A-Z])”).Value

Hi , somehow still missing some value with the same use cases


truth is the solution from vrdabberu works ,

but if you have a solution which can get same output with same accuracy i will tag yours as solution


Can you please send me all the required ouputs?


Is my regex expression is not working for you @StevenIsRobotOnline

Check the below one. Let me know if it’s now working


Could please provide me all the input and output texts.



=> Assign -> StrOutput = System.Text.RegularExpressions.Regex.Match(StrVar.ToString,"(((?<=[A-Z]+\s*[A-Z]+\s+.?)\d+)|((?<=[A-Z]+\s+[A-Z]+\d+\s+[A-Z]+.?\s+[A-Za-z]+.?\s+[A-Za-z]+\s+.?[A-Z]+)\d+)|((?<=[A-Z]+\s*[A-Z]+)\d+(?=\s*$))|((?<=[A-Z]+\s*[A-Z]+)\d+(?=[A-Z]\s*$))|((?<=[A-Z]+\s+[A-Z]+)\d+(?=[.,|@]))|((?<=[A-Z]+)\d+(?=[A-Z]+))|((?<=[A-Z]+\s+[A-Z]+\-)\d+)|((?<=[A-Z]+[.,@|-]+)\d+)|((?<=[A-Z]+\s+[A-Z]+)\d+(?=\s+[A-Z]+\d+))((?<=[A-Z]+\s+[A-Z]+)\d+(?=\s*$)))").Value

Hope it helps!!

finnally , thank you so much

1 Like

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