string = '(ds2)sdffS2(d3sfD)(sdfN4)2dsf(sdfj)'; workString1 = string.replace( /[()]/g, '|' ); alert( workString1 );