Custom Numeric Validation | XM Community
Skip to main content
Hi,

I am having participants estimate different amounts. I want their responses to be numerical and estimated to the second decimal point (e.g., 17.15). I cannot find a way to do this in Qualtrics with the existing options. For Content Validation I can specify numeric, a min, a max, and the max number of decimals (when really I want a min number of decimals). I maybe be able to achieve my goal via the Custom Validation with regex code.

Can anyone help me with this? Thank you!!
hi @ecw2144
You can use custom validation where the text entry matches with the following regex:
^\\d+\\.\\d\\d$
Hope this helps 🙂
> @NiC said:
> hi @ecw2144
> You can use custom validation where the text entry matches with the following regex:
> ^\\d+\\.\\d\\d$
> Hope this helps 🙂

Except Qualtrics doesn't recognize shorthand character classes, so you have to do it like this:
```
^[0-9]+.[0-9]{2}$
```
> @TomG said:
> > @NiC said:
> > hi @ecw2144
> > You can use custom validation where the text entry matches with the following regex:
> > ^\\d+\\.\\d\\d$
> > Hope this helps 🙂
>
> Except Qualtrics doesn't recognize shorthand character classes, so you have to do it like this:
> ```
> ^[0-9]+.[0-9]{2}$
> ```
>

It works i tried it before suggesting it 🙂
> @NiC said:
> > @TomG said:
> > > @NiC said:
> > > hi @ecw2144
> > > You can use custom validation where the text entry matches with the following regex:
> > > ^\\d+\\.\\d\\d$
> > > Hope this helps 🙂
> >
> > Except Qualtrics doesn't recognize shorthand character classes, so you have to do it like this:
> > ```
> > ^[0-9]+.[0-9]{2}$
> > ```
> >
>
> It works i tried it before suggesting it 🙂

If it does, it must be something new. It has never recognized them before.
Thank you @NiC and @TomG -- I was able to get it to work as needed! 😀
> @ecw2144 said:
>
> For Content Validation I can specify numeric, a min, a max, and the max number of decimals (when really I want a min number of decimals).

Hi ecw2144, I was searching for my questions about setting decimal places in my custom validation when I came across your post. I believe you know the answer to my question. Can you please tell me how to specify the max number of decimals for a numeric entry? I was able to specify the max and min of the range, but couldn't figure out about the decimals.

Thank you!

Leave a Reply