I have a requirement where I need to format 'Phone Number' field which is of type 'Phone'. It should not allow some of the special characters like %$#@*&, so am trying to replace each character individually with blank as below but it's acting weird. Am using the expression as below to replace everything except alphanumeric values and the 2 characters ( & ).
Acc.Phone = Acc.Phone.replaceAll('[^\\(\\)][^a-zA-Z0-9]','');
And when I entered
Its formatted as
If someone understand what's happening and where am doing the mistake, please correct me.