Index: TemplateParseUtil.java =================================================================== --- TemplateParseUtil.java (revision 53092) +++ TemplateParseUtil.java (revision 54204) @@ -119,19 +119,19 @@ /** * Defines the valid chars for a replacement variable */ - public static String VALID_VAR_CHARS = "[A-Za-z0-9\\\\(\\\\)\\.\\-_=,:;!~]"; + public static String VALID_VAR_CHARS = "[A-Za-z0-9\\\\(\\\\)\\+\\*\\.\\-_=,:;!~@%]"; /** * Defines the valid chars for a parser input (e.g. entity reference) */ - public static String VALID_INPUT_CHARS = "[A-Za-z0-9\\\\(\\\\)\\.\\-_=,:;!~"+SEPARATOR+"]"; + public static String VALID_INPUT_CHARS = "[A-Za-z0-9\\\\(\\\\)\\+\\*\\.\\-_=,:;!~@%"+SEPARATOR+"]"; /** * Defines the valid chars for a template */ - public static String VALID_TEMPLATE_CHARS = "[A-Za-z0-9\\\\(\\\\)\\.\\-_=,:;&!~"+SEPARATOR+"\\{\\}]"; + public static String VALID_TEMPLATE_CHARS = "[A-Za-z0-9\\\\(\\\\)\\+\\*\\.\\-_=,:;&!~@%"+SEPARATOR+"\\{\\}]"; /** * Defines the valid template chars for an outgoing template (allows ?) */ - public static String VALID_TEMPLATE_CHARS_OUTGOING = "[A-Za-z0-9\\\\(\\\\)\\.\\-_=,:;&!~"+SEPARATOR+"\\{\\}\\?]"; + public static String VALID_TEMPLATE_CHARS_OUTGOING = "[A-Za-z0-9\\\\(\\\\)\\+\\*\\.\\-_=,:;&!~@%"+SEPARATOR+"\\{\\}\\?]"; /** * Stores the preloaded default templates @@ -303,11 +303,17 @@ String extension = null; if (input != null) { int extensionLoc = input.lastIndexOf(PERIOD, input.length()); - if (extensionLoc > 0) { - stripped = input.substring(0, extensionLoc); - if ( (input.length() - 1) > extensionLoc) { - extension = input.substring(extensionLoc + 1); - } + if (extensionLoc == 0) { + // starts with a period so no extension, do nothing + } else { + int sepLoc = input.lastIndexOf(SEPARATOR, input.length()); + if (extensionLoc > 0 + && sepLoc < extensionLoc) { + stripped = input.substring(0, extensionLoc); + if ( (input.length() - 1) > extensionLoc) { + extension = input.substring(extensionLoc + 1); + } + } } } return new String[] {input, stripped, extension};