Cleaning Up Source Data

Here's an example of cleaning up bad characters from email addresses. Notice the begin and end quote characters (\Q \E). This is a java feature that saves you the pain of escaping all the special characters. Also notice the ^ for inverse at the beginning.

var email = work.ohioEduPersonDeliveryEmail.getValue(); 
if (email != null) {
email = email.replaceAll( "[^\Qa-zA-Z0-9@!#$%&'*+-/=?^_`{|}~.\E]", "" );