Skip to main content

Hi,

 

I want to match the following patterns:

Pattern 1: 1234567

Pattern 2: 1234567;1234567;...

 

How to create a new validation pattern in K2 Five to match either Pattern 1 or Pattern 2 above? i.e. The user has to enter a 7-digits string. The user can enter multiple 7-digits strings but must be delimited by semicolon (;).

 

If the user enters a string different from Pattern 1 or 2, K2 will show a validation error.

 

Hello  @tiongbahru 

 

How To: Add Validation to a Form :

https://help.k2.com/onlinehelp/k2five/userguide/5.0/default.htm#How_Tos/ValidateForm/Add-Form-Validation.htm

 

How To: Add Validation to a SmartForm:

https://help.k2.com/onlinehelp/k2smartforms/userguide/4.7/default.htm#How_Tos/Add_Validation_to_a_SmartForm/Using_a_Validation_Pattern_and_Rule_Condition.htm

 

How To: Use Regular Expressions to Validate Control Values:

https://help.k2.com/onlinehelp/k2five/userguide/5.3/default.htm#How-Tos/ValidateForm/Add-Form-Validation.htm

 

Enjoy.


Follow the links KagisoMasha wrote on how to add a new validation pattern and how to apply it.

The expression you are after, is if I understand it correctly

^(d{7};{0,1})*$

Validation result:

"1111111;1111111;2222222;" - Match

"1111111" - Match

"1111111;" - Match

"1111111 ;1111111" - Not match

"11111a1;1111111" - Not match

"1111111;1111111 " - Not match

 

Regards

/Björn Ramnor


Reply