Remove All Special Characters From String In Apex Biswajeet June 14, 2016 1 Comment on Remove All Special Characters From String In Apex Sample Code: String name = '{B]@i%s*w:?,-a$j#e)e(t! S^a.m}a]l['; name = name.replaceAll('[^a-zA-Z0-9\\s+]', ''); System.debug('Name-' + name); Output: