Help me to only et the words after spesific numbers

i had posted before this , it was to get numbers from a string with specific rules here is the link

But now i want to get the words before the spesific number and it will ignore the spacing or symbol (" " or"," or ,β€œ-”)
thank you

use cases example :slight_smile: , the β†’ is the output i want , thank you :
1.WILDUN DUMA 8515 β†’ output : DUMA
2.WILWAL SE1865 GEN+ Feed, Food (N570) - > output : SE
3.WILWAL AI1865 GEN+ Feed, Food (N570) β†’ output : AI
4.WILDUN1840GKP+FEED,FOOD(I570)/RSPOMB β†’ output : WILDUN
5.LOREM LS8515, WEN+ FEED, WATER (E570 - > output : > LS
6.LOREM IPSUM 8515 - > output : IPSUM
7.LOREM IPSUM-8515 - > output : IPSUM
8.LOREM IPSUM8515-> output : IPSUM
9.LOREM IPSUM8515 WATER2570 - > output : IPSUM

Please help me to get the corrcet output thank youu

Hope it helps,
Happy automation

Hi The DUMA and IPSUM is a random word,
and i want to catch the word before the number

thanks

Hi @StevenIsRobotOnline

Try this Regex Expression:

(?<=\d\.[A-Z\s]+?[A-Z\s]+?\-?)\d+|\d+(?=[A-Z])

Hope it helps!!

take the dynamic value which you get before or after the number you need to extract
pass into a variable then use this regex pattern in the place of IPSUM

Hi Thanks for the reply ,

but my question is
how to get the value of the word before the numbers ,
not to get the value of the numbers in this string

thank you for the advice anyway

Hi @StevenIsRobotOnline ,

Maybe you could check with the Below Regex :

^.*?\s?([A-Za-z]+)\s?[-\d]+

Expression :

Regex.Match(strVar,"^.*?\s?([A-Za-z]+)\s?[-\d]+").Groups(1).ToString

Debu Panel :
image

@StevenIsRobotOnline

First use this regex to get the value…the first matched value is what you need so use as below and then you can replace all special characters and spaces

[A-Z]*[ \-,]*(?=\d{4})

System.Text.regularExpressions.Regex.Replace(System.Text.regularExpressions.Regex.Match(str,"[A-Z]*[ \-,]*(?=\d{4})").Value,"[^A-Z]","")

[^A-Z] - this takes care of removing extra characters

Hope this helps

cheers

1 Like

use this in assign activity…here str is a string variable containing each string eg: WILDUN DUMA 8515

and the output of this world be the required string

Hope this helps

cheers

1 Like

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