Hi openforis Team, I am trying to use pattern in collect earth form. I tried to research input pattern in xml but I could not understand clearly because I could not get examples what I wanted. I am trying a pattern something like this e.g. (MAK/BH/99/99). My user will input in that pattern. Will you please give me example what pattern should I define ? thank you in advance.
Accepted answer
Hi Rajkumar,
The pattern you can define must be a regular expression. You can find a lot of documentation and tutorials in internet about that and even live regular expression tester (see for example RegExr). In Collect Survey Designer you can define a Pattern Check for a Text attribute so that the entered values will have to match the specified regular expression. In your case the expression can be this:
[A-Z]{3}\/[A-Z]{2}\/[0-9]{2}\/[0-9]{2}
That means: accept only 3 uppercase letters followed by a forward slash "/" (you have to escape it using a backward slash before it) then accept other 2 uppercase letters followed by "/" then 2 numbers and a forward slash and other 2 numbers.
Also in the Message box of the Pattern Check please specify a meaningful error message for the users.
I hope this will help you.
Thanks.
Open Foris Team