Field validation with regex

I am trying to validate a field using a regex. This field is in a sys_Table control. I added a regex validation to check that only alpha, numeric, and the slash, period, and hyphen chars can be present. I used the following regex: ^[a-zA-Z0-9-/.]+$

I tested this regex with online tools and it appears to work.

I also set the Required checkbox.

When I try to push a content item based on this type through the workflow, it does appear to validate against the Required, but it doesn’t validate against the regex.

Any ideas on what I’m doing wrong?

Thanks.

I’d be inclined to escape the ‘.’ since that usually matches any single character other than newline. I know that the IEEE standard specifies that the period ‘.’ loses its special meaning if enclosed within brackets, but I’m not 100% sure if Sun coded java regex to honor that.

^[a-zA-Z0-9-/.]+$

If that still doesn’t get it for you, tell us the exact string you’re trying to validate.

don’t use the ^ and $

I did some more testing and found that no regex validations, including the built-in ones like string length, work on a field in a table. The validations work on regular fields, but if the field is in a sys_Table, they are not validated against. Anybody know a workaround (other than not using a table)?

I would say that this should be worthy of a ticket filed to percussion tech support…if they already don’t have one…

If you have a sys_Table control, I assume that this is a complex child field. Rather than trying to apply a single validation to all fields in that child (which isn’t supported,) you should apply the regex to each field in the child.

The validator is on a field within the child table.

Any progress on this issue? I am running into the same problem. It appears that NO validation runs for the child table because I can put other types of validation in place such as JEXL empty($value), string length, and number range… none of them work.

I’m running 7.03 BTW.

Thanks,

-J

This issue was logged internally as bug RX-16358 should have been resolved in 7.x and 6.7 with patch RX16407 and later. could you pleas log this through tech support. Thanks

The fix was included in the 6.7 patch but was not put into the main code branch. We are currently creating a patch for 7.0.3, if you are on a different version and require this fix you will need to request a patch through tech support.