Extract text between brackets

#1

Hi Guys,

I need to extract text present in the bracket from the whole string
The string1 is: ELIGIBLE - PREMIUM TAB (PREMTAB_HCC)
And the string2 is : ELIGIBLE - PREMIUMTAB (PREMTAB_HCC) | 2 Year | PREMTAB_HCC

I want to match only the text present in bracket if it is same or not i.e. (PREMTAB_HCC)

Please help

#2

You’re going to need to use regex to look for a string that fits the form of ( stuff ) then trim off the () and return whatever is left.

You can probably harvest the code out of this:

#3

Hi @somya177,

You can assign String_var=System.Text.RegularExpressions.Regex.Match(Your_String,"\(.*\)").ToString to extract the value inside the parenthesis.

Warm Regards,
Nimin