Replace bracket

Hi Team,
I want to replace bracket with minus sign
Like (1234) to replace -1234
Any way please let me know

@AsadPathan2665
You can go like,
YourValue.replace(“(”,“-”).Replace(“)”,“”)

1 Like

HI,

How about the following?

System.Text.RegularExpressions.Regex.Replace(yourString,"\(([\d.,]+)\)","-$1")

image

Regards,

2 Likes

@Yoichi Can you please explain the expression ?

-$1?

1 Like

Hi,

$1 is regex substitutions meta character. It will be replaced with the first matched group.

Regards,

2 Likes

Thank you so much @Yoichi

1 Like

Thanks @Shubham_Kinge

1 Like

Thanks @Yoichi

1 Like