Validate Field containing a limited set of characters

How to build a Segment/Field rule validating that a field contains a limited set of characters

We’ll validate that PID.19 (SSN Number) is 9 digits long.

  1. In the inbound HL7 task, select the Validation tab
  2. Select the Segment/Field Validation tab
  3. Add the rule:  PID.19 is matching regex ^[0-9].*{9}$
    The rule means that from the beginning of the field value (^) up to the end ($), there are digits ([0-9] found 9 ({9}) times.


    Note: The following rule is equivalent:  PID.19 is matching regex ^[0|1|2|3|4|5|6|7|8|9].*{9}$ and just list the allowed characters one by one.  Feel free to change the list of characters to adapt it to your situation.

 You can download the rule file for use in Caristix Workgroup or Test software.

Download the rules file (Field contains some characters only.cxf)

Learn more about how to import validation rules into an inbound HL7 task.