How to Get After or Before text in string Value

  1. MENS 10 1/2 LDS 7 1/2 in this case i want to extract after LDS Number (LDS 7 1/2)
  2. 9LDS,14MEN,14KTTSET in this case in want extract Before LDS Number(9 LDS)
    3)MENS SIZE14 LDS SIZE10 in this case in want extract afterLDS (LDS SIZE 10)

Hi,

Can you try the following expressions?

System.Text.RegularExpressions.Regex.Match(text,"(?<=LDS)[/\d\s]+").Value

This returns 7 1/2.

System.Text.RegularExpressions.Regex.Match(text,"[/\d\s]+(?=LDS)").Value

This returns 9.

System.Text.RegularExpressions.Regex.Match(text,"(?<=LDS SIZE)[/\d\s]+").Value

This returns 10

Regards,

2 Likes

thanks

1 Like

hi,

how to get ismatch result in variable what is match just like (Ram ,Laxman)
when ismatch activity give me result true or false but i need what he match just like(Ram)
it is possible?

Hi,

We can use Match method for it as the following.

System.Text.RegularExpressions.Regex.Match(text,"Ram|Laxman").Value

This returns matched string. If there is no matched string, the return value will be String.Empty("").

Regards,

1 Like

thanks

how to use if condition System.Text.RegularExpressions.Regex.isMatch(Wmatch(0).tostring,"([0-9]+)")
when above ismatch Activity result is false then if condition active

Dear @Ram_Gurav,

I have tried string manipulation to get the excepted output.
PFA.
Hope this could help.

StringManipulation.xaml (8.7 KB)
Regards,
Geet M

Dear @Ram_Gurav,StringManipulation- Output Only Number.xaml (11.3 KB)

If you are looking only for Number as in output.
PFA.

Regards,
Geet M

thanks geet

i want only two text in below string (“O” and “Q”)
MGJ-BULK ORDER. SIZE= O X 8 & Q X 2
also we require number after that O=8 and Q=2
it is possible???