All formatting and parsing of cspace RefNames should ideally happen through our API. cspace exports a module for this purpose, which has the minimum of dependencies, and is available from Artifactory. It should be painless to integrate this module into a maven build.
The easy way to get the module is to modify your project's pom.xml file. Instructions are here: ServicesCommonAPI
(Please look in test cases for RefName in RefNameTest for the most up-to-date examples).
Basically, you call like this to format:
And you call like this to parse:
but these are examples, and subject to change.
The regular expressions used to parse are publicly available, so please reference them from the RefName class if you need to know it, although it will be preferable to use RefName.AuthorityItem.parse() and RefName.AuthorityItem.parse() for all parsing.
Please see the class RefNameTest in the services code here: