How to extract a specific string from a main string using string manipulation

HI All,
I have a string like this - =ROUND(‘10A’!E77,2)

I need to extract the string after the character ! till next 3 digits. Means in the above string I need
E77 as an output after the string manipulation.

Hi @Karan28,

The following will do

System.Text.RegularExpressions.Regex.Match(myString, "(?<=!).+?(?=,)").Value

1 Like

@Karan28 You might also could try with the Split method to get the value you need:


But there might be errors in cases where the Split Value may not be present, you may need to handle those cases.

Hey , thanks for the solution . It worked for the above mentioned string but giving null value incase of this -=‘9’!E39 string. My ultimate aim is to get 3 character string just after !.

and the main string willl be of any type.

Hey thankyou so much , this worked in all the cases

1 Like

Hi Sorry for saying late but this manipulation taking the data from ! to the end of the string and I want till 3 characters.

=+‘P&L Notes’!D12+0.0035

for ex, here I want only D12

and your logic is giving me D12+0.0035 as output

@Karan28 If it’s always 3 Character after the ! that you want to extract then you can use this :


Thankyou so much , it worked

1 Like

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