See this helpful document https://docs.opendatakit.org/form-regex and you can see this discussion Use of regex on xlsform