Extracting string betvien two characters

Hi, can somebody help me extract the string between 2 characters?
I need a string between “" and “(” or "” depends witch comes first.

ex.
a) “asglas_1234567_” = 1234567
b) “asglas_1234567(” = 1234567

Hi @tomaz ,

Is the Number (1234567) the Output that you require ?

Hi you can use regex to extract the desired output from string

use matches activity
image
properties panel
image
and enter regex pattern in matches activity: \d*
image

You will get your output and then convert that to string

Thank you

Hello @tomaz
You can use the regex method
YourString= “asglas_1234567_” = 1234567

System.Text.RegularExpressions.regex.Match(YourString,"\d+").toString.Trim

image

Yes, but this is only a exemple, the correct string vill not be only numbers.

Hi @tomaz,

Check out this regex : System.Text.RegularExpressions.Regex.Match(test,“\w+(”).ToString.Replace(“_”,“”).Replace(“(”,“”)

image

Thanks & Regards,
Dibyaprakash

You can mark this as solution if your issue was resolved.

@tomaz ,

The above Statement and the example provided creates a bit of confusion as to what is really required ?

Do you want the String between the Double Quotes and Brackets or Just the number between them ?

More samples would help us strict the conditions and therefore build a concrete logic for the problem.

HI @tomaz

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=asglas_)\d+(?=_|\()").Tostring

image

Regards
gokul

try this

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=\Wasglas\w).*(?=_\W)|(?<=\Wasglas\w).*(?=\W\W)").Tostring

image

Hi @tomaz

Instead of \d+ use \S+

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=asglas_)\S+(?=_|\()").Tostring

image

Regards
Gokul

You can also try this :
image

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