Java tutorial
//package com.java2s; public class Main { private static String safeInstanceIdFolderName(String instanceId) { if (instanceId != null && instanceId.length() != 0) { String instanceFolder = instanceId.replaceAll("(\\p{P}|\\p{Z})", "_"); return instanceFolder; } else { throw new IllegalArgumentException("getInstanceFolder: instanceId is null or the empty string!"); } } }