At times, there may be a need to filter out unwanted characters or substrings from entered data or validate that data for formatting (e.g. phone number,
SSN, etc.) before storing it. The Regular Expression processing has not yet been fully implemented in Connector Express.
Here is a workaround to implement regular expressions using the JCS override.
You are creating a custom LDAP/JNDI endpoint and would like to filter-out any non-numeric characters from the telephone number entered by the user.
This will allow different clients connecting to that LDAP to format the data as per their needs without having to account for arbitrary formatting
characters [e.g.: ( , - , + , etc.]
Support for RegEx conversion via connector metadata has not been fully implemented. Instead we recommended that you create a new flexi string type for any
attributes that you want to convert and add the regex conversion via the connector type's override connector XML file..
First, define a new custom string type. For this use case, we create a "NumbersOnly" type.
Edit the JCS_HOME\conf\override\jndi\connector.xml to add regex conversion for that string type.
A sample.connector.xml is provided for your convenience; you will need to copy it to a new file named connector.xml.
There is also a JDBC override folder if your use case is for JDBC. See the attached example for JDBC.
** Note that is appears that in 12.6 the
file for JDBC is not being created. You will need to manually create a 'jdbc' subdirectory under
and use the attached connector.xml as a starting point.
The new regex conversion section looks like this:
<!-- remove non digit characters from the string, e.g. formatting characters in phone numbers -->
<!-- style -->
<!-- regex -->
Restart the Java Connector Server for the changes to take effect.
In your connector, you will now define the relevant attribute (TelephoneNumber, in this case) as type "flexi - numbersonly".
Save and deploy your connector as usual.