I'm trying to remove parenthesis and text within it. Eg: Column1 has data and cleaned data should look like column2
Column1 Column2
HF(abcd) HF
BP(234) BP
ATRS (2354) ATRS
AB(PS) SD(12) AB SD
I'm trying to use the below regex just to view the cleaned data, But I'm doing it wrong
s/([^)]*)//
select Column1 from table where Column1 like '%s/\([^)]*\)//%'
What is the best possible solution for this
THIS ANSWERED THE ORIGINAL VERSION OF THE QUESTION.
What regular expression? You just want everything before the (
:
select left(column1, charindex('(', column1) - 1)
If you might not have the opening paren, you can do:
select left(column1, charindex('(', column1 + '(') - 1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With