# Problem with regex

**URL:** <https://forum.getodk.org/t/problem-with-regex/27069>\
**Category:** Support\
**Created:** [June 4, 2020, 5:31pm UTC](https://forum.getodk.org/t/problem-with-regex/27069 "2020-06-04T17:31:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Over\_Murillo\_Chacon](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/over_murillo_chacon/32/8457_2.png) [@Over\_Murillo\_Chacon](https://forum.getodk.org/u/Over_Murillo_Chacon)\
**Post date:** [June 4, 2020, 5:31pm UTC](https://forum.getodk.org/t/problem-with-regex/27069/1 "2020-06-04T17:31:38Z")

</div>

Hello everybody

**1. What is the problem? Be very detailed.**

I have a validation with regex in the constraint of the form since it works correctly in the file in the online test environment ([https://getodk.org/xlsform/](https://getodk.org/xlsform/)) but being in the latest version of ODK Collect 1.27.1 it does not work .

The conditions are as follows: regex (., '[A-Z]') and regex (., '[A-ZA-Z]')

**2. What app or server are you using and on what device and operating system? Include version numbers.**  
Aggregate 1.7.3 y ODK Collect 1.27.1

**3. What you have you tried to fix the problem?**  
NA

**4. What steps can we take to reproduce the problem?**  
I attach the test file with the question

[test.xlsx](https://forum.getodk.org/uploads/short-url/dZoZJu8vxMYautDYlaYrpkyuDuc.xlsx) (187.5 KB)

---

<div class="post-metadata">

**Author:** ![Xiphware](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/xiphware/32/2587_2.png) [@Xiphware](https://forum.getodk.org/u/Xiphware)\
**Post date:** [June 4, 2020, 8:44pm UTC](https://forum.getodk.org/t/problem-with-regex/27069/2 "2020-06-04T20:44:57Z")

</div>

> [@Over\_Murillo\_Chacon](#):
>
> regex (., '[A-Z]')

Can you perhaps describe what constraint you are attempting to enforce? eg a specific string that should match vs one that should fail... FYI the ones above will check for the presence (one or more occurances) of an uppercase letter in your string.

---

<div class="post-metadata">

**Author:** ![Xiphware](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/xiphware/32/2587_2.png) [@Xiphware](https://forum.getodk.org/u/Xiphware)\
**Post date:** [June 4, 2020, 9:05pm UTC](https://forum.getodk.org/t/problem-with-regex/27069/3 "2020-06-04T21:05:05Z")

</div>

FYI, you should probably be aware that there is a slightly different behavior wrt the `regex()` function between Collect and Enketo; documented here: [https://github.com/getodk/javarosa/issues/531](https://github.com/getodk/javarosa/issues/531)

Net is that you should probably include the `^` (start string) and `$` (end string) delimiters in your regex expression, otherwise it'll match any _substring_ - depending on what XForm client you use... So, for example, if you want to make sure a string contains only uppercase characters, try:

`regex(., '^[A-Z]*$')`

---

<div class="post-metadata">

**Author:** ![Over\_Murillo\_Chacon](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/over_murillo_chacon/32/8457_2.png) [@Over\_Murillo\_Chacon](https://forum.getodk.org/u/Over_Murillo_Chacon)\
**Post date:** [June 4, 2020, 10:12pm UTC](https://forum.getodk.org/t/problem-with-regex/27069/4 "2020-06-04T22:12:55Z")

</div>

Thanks for the help, indeed they were the limiters of the regex
