Extract a text from a string

Hi Forum members,

I have a text {Custom=SCH100207;}

I wanted to extract only SCH100207 from this string.

Any leads will be appreciated .

Sahil Garg

Hi @Sahil_Garg1

Is this always like this starting with custom and ending with a semicolon…

Then we can write a regex



1 Like

Hi ,

Yes it is always

@Sahil_Garg1 then please try the above regex it will work…

Curly bracket will come right?

If it comes it will work else we need to remove the Curly bracket from.the regex pattern also


1 Like

You can use Substring to get that. Something like this:

variable1 is the main string here.

variable1.Substring(variable1.IndexOf("=") +1, variable1.IndexOf(";") - variable1.IndexOf("=")-1)

1 Like

Hi Prasath, Hi Shiwangi,

Thanks to both, both solutions are working fine.

@prasath_S , can you please tell me how you made this regex, i want to learn it .


I learnt from this website,

The regex will search for particular match before and after the pattern we want to capture.


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