private static String findRuleName(String ruleContents, CmdArgsParser options) {
//TODO: this is incorrect - what if a rule starts 'rule"rule1"'??? use the getRuleStart method to find the beginning
String name = ruleContents.substring(ruleContents.indexOf(PH_RULE_START) + PH_RULE_START.length(), ruleContents.indexOf(PH_NEWLINE)).replaceAll("\"", "").trim();
if (!name.matches("[^'^/^<^>.]+")) { //Guvnor seems to not like some characters
Logger logger = LoggerFactory.getLogger(PackageFile.class);
logger.debug("WARNING: fixing invalid rule name [old name=" + name + "]");
name = name.replaceAll("'", ""); //remove all ' chars since they are not valid in rule names
name = name.replaceAll("/", "-"); //remove all / chars since they are not valid in rule names
name = name.replaceAll("<", "<"); //remove all < chars since they are not valid in rule names
name = name.replaceAll(">", ">"); //remove all > chars since they are not valid in rule names
}