The JCR naming restrictions are described in the Repository Model section of the JCR specification.
Specifically, the following characters are not allowed:
(“/”, “:”, “[“, “]”, “|”, “*”)
There is a com.day.cq.commons.jcr.JcrUtil class has a createValidName(title) method which may be able to help you. By default the STANDARD_LABEL_CHAR_MAPPING
will replace all illegal characters with an underscore. It is possible to use the HYPHEN_LABEL_CHAR_MAPPING
to replace with a hyphen using the createValidName(title, labelCharMapping[]) method.