0

I am experimenting with Cognito Forms' new feature of text input validation by use of Custom Regular Expressions. I was asked by one of our departments to make the name fields autocorrect so as to make the first character of each uppercase if the user or person filling out the form accidentally leaves it lowercase. I got the regular expression that I want to use:

Image Capture

However, every time I click SAVE the Reformat Expression box becomes blank, and the Custom Regular Expression doesn't work as expected.

I used RegEx to test my regular expression format to make sure it's correct, and I even used the custom error message on the Cognito Forms app to make sure the form is reading the regular expression correctly. But for whatever reason, it won't accept the Reformat Expression I enter.

Does anyone have any idea or have any more experience with regular expressions used in Cognito Forms?

1

Cognito Forms supports any regular expression that will work in a web browser using JavaScript, so this is not specific to Cognito Forms.

As noted in our help documentation, there are a number of good websites for learning how to write and test regular expressions. If you are still stumped, try posting on Stack Overflow, as this is really a programming question and more appropriate for those forums.

In this specific case, the issue is with your reformat expression, where you are trying to include the first group ($1). However, since there are no () in your regular expression, there are no groups. To include the entire value, use $& instead.

  • Thank you. I tried $& in the Reformat Expression field and tested it and it still did not work. – Mike Duggan Dec 7 '16 at 20:01

protected by Community Oct 16 '18 at 21:20

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.