I am trying to use some validations on questions in a survey to reduce the percentage of dirty data that comes in, I have tried to apply the the regex syntax below for the entry of a unique id in the format KN-GGG-DE-012
It looks like your expression is missing the last dash, the one between DE and 012.
When testing regexs like this, I'd highly recommend building the expression in an online regular expression tester, as it's much quicker to test in isolation. You can also build up the expression piece by piece, testing along the way, so when there's a failure, you know where it comes from.
Thanks a lot, yes i built this piece by piece using the regexr builder but i had to do some manipulations because the expression as is doesn't pull any matches in the regexr when i type in a unique id. The code below is what actually worked in the expression builder but doesn't work in Commcare
One thing I noticed was that your original expression included this type of apostrophe: ‘ rather than the basic '
The former gives me an error in CommCare. This can sometimes happen if you write the expression in a rich text editor such as Microsoft Word. It may also have been the forum software transforming it in your message, I'm not certain. Can you try pasting this expression exactly and confirming that the apostrophes are simple?
Hi Jay, I think the issue with the one Ethan pasted is that it contained 'fancy' unicode quotes instead of the normal ASCII quotes ‘ vs ' (notice how the unicode ones are are slanted). This is often a challenge when copying things from a web browser or document.