Skip to main content

Helpfule Regex - Regular Expressions in Salesforce.com

Post for later reference about regex


val = 'random string!@#$%^&*()_';

//AlphaNumber Only
val = val.tolowercase().ReplaceAll('[^a-zA-Z0-9]', '');
//AlphaNumber Only + Special characters
val = val.tolowercase().ReplaceAll('[^a-zA-Z0-9@$_.~\'-]', '');
system.debug(val);

Comments

Popular posts from this blog

Override Name in the Salesforce Cloud Console

Service Cloud Console HyperLink Opens new window outside of the console, Opens new tab inside the console. HYPERLINK("javascript:if(typeof(srcUp)=='function') {srcUp('/" & Id & "?isdtp=vw');}"+ " else {window.location.href='/" & Id & "'}", User__r.FirstName + ' ' + User__r.LastName, "_self" ) Checks if the srcUp exists and if it does, you're in the console.