Need to Extact data between brackets

hello,

i need to etract data between brackets
DSNA MOeLITE (DC0087)_2025-08-01_2025-09-15.xlsx

output i need -
DC0087

plesae help

@Mathkar_kunal,

Use regex for this

strExtractedValue = System.Text.RegularExpressions.Regex.Match(strFileName, "(?<=\()[^)]*(?=\))").Value

1 Like

Hello @Mathkar_kunal,

Use regex for this:-

System.Text.RegularExpressions.Regex.Match(strFileName, β€œ((DC\d+))”).Groups(1).Value

1 Like

Hey @Mathkar_kunal buddy use this string manipulation to extract it dynamically like if any value in the bracket then it’ll extract those but first store this string in variable

str_Output = str_String.Split(β€œ(”)(1).Split(β€œ)”)(0)

Cheers

Hello @Mathkar_kunal,

Use dynamic regex for this:-

System.Text.RegularExpressions.Regex.Match(strFileName, β€œ(([^)]+))”).Groups(1).Value

1 Like

Hi @Mathkar_kunal

Use this regex (?<=()[^)]+(?=)) to extract the bracket value.

strextractedvalue = System.text.regularexpressions.regex.match(strFilename, "(?<=\()[^)]+(?=\))").value

strFilename = DSNA MOeLITE (DC0087)_2025-08-01_2025-09-15.xlsx

Thanks!!

1 Like

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