Six Stars

replace.All with multiple replacement

Hello,

 

I'm trying to delete "(" and ")" in  a string (in one treatment).

Input example :

(Cat)

(Dog)

row1.COM_ARTMIN.replaceAll("(|)","")

But that's don't work.

Output I expect :

Cat

Dog

 

What is the correct syntax to had this done ?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: replace.All with multiple replacement

Ok found it after some tries ^^

I need to escape "(" and ")" which are specials chars here (with \\)

row1.COM_ARTMIN.replaceAll("\\(|\\)","")
1 REPLY
Six Stars

Re: replace.All with multiple replacement

Ok found it after some tries ^^

I need to escape "(" and ")" which are specials chars here (with \\)

row1.COM_ARTMIN.replaceAll("\\(|\\)","")