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
7876*78(67)87564#7
Its formatted as
7877687567
Ex2:
96*85/56+98(45)874*568(
formatted as
985948756
If someone understand what's happening and where am doing the mistake, please correct me.
Thanks.