Field validation check for Regex

Hi.

Is there a way to use field validation and check for special characters in the text field?
For example, if users type space or underscore in the text field the field validation would fail.

Thanks!

BR.
Hivzo.

Hi @HCEH, there unfortunately isn’t a way yet to check for special characters in the text field validation. If we were to add ‘Does not contain’ rules to the validation options, do you think that would allow you to achieve this?

Thanks @shep
“Contains” and “Does not contain” relates to an array or object list and not to the specific characters in the text field.
I would suggest having an option to select Expression in validation rules. That would open up for a number of possibilities to validate the field including the check for special characters.

@HCEH Adding the ability to create expressions in the validation rules is definitely clear here. However, I’m wondering if we were to add a “Does not contain” rule and you were to specify the special characters, would this work for you?

For example: “Does not contain” “_” and “Does not contain” “[space]” would check if these characters would appear in the user input.

Would this happen to work for you?

Hey @shep
Please correct me if I am wrong but the current logic is based on the object lists or arrays and not exactly on the string. So I searching for the single characters with current logic implemented in the validation would not work. Am I being wrong here?

The current “Contains” validation logic works as such — it searches the string to validate that it contains a particular character or value defined in the rule.

So, for your case, you could write the validation rule on a text input field:

  • Contains *
  • Contains _

This would check to make sure that both a * and _ are in the string.

Do you think a Does not contain rule that works the same way satisfy your original request? Meaning, it would check to see if the input contains a special character defined in the rule and throw an error if it does.

1 Like

@shep
“Does not contain” would definitely satisfy my need to check for those unacceptable characters in the string.

Thank you very much!

1 Like