Substring between two strings

string s1=aabcsderf (123457)
how to get the substring of ( and )

1 Like

You want to get value between ( ) ?

Hi @KarthikBallary
You can use this regex:

yes! make sure u send a hardcode syntax

srry I didn’t get

This is good solution only if he is expecting numbers between brackets, if he is not he can use this


@KarthikBallary you can use this Pattern in Regex Matches activity.
The result it creates is IEnumerable< Match> So you need to select the first matching group with

Yah of course with SubString it can be mentioned like this
Out_s1= s1.Tostring.Substring(s1.Indexof (“(“)+1, s1.Indexof(“)”)-1)
Where the output would be 123457

Cheers @KarthikBallary

1 Like


1 Like


You can use Matches activity and use expression from my screen. It will get you those numbers from input of string from your example. In case if between brackets there are not only numbers you can use this expression as well:

I am getting this exception

1 Like

Fine got it
s1 = aabcsderf (123457)
Out_s1= s1.Tostring.Substring(s1.Indexof (“(“)+1, ((s1.Indexof(“)”)-s1.Indexof(“(“))-1))

This would work for sure
I didn’t see aabcsderf term along the string

Cheers @KarthikBallary


is that working buddy
Cheers @KarthikBallary

1 Like

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