This regex is not enough. It could be possible to use a parameter for only a subset of the value (even if it is not common at all for service class names).
The simplest implementation is probably to catch the exception when resolving the value