How to setup a REGEX for UP TO 14 Digits Tel-Number?

Hello,

Referring to following discussion : https://community.kobotoolbox.org/t/how-can-i-create-a-form-to-input-phone-number-in-questionnaire/797/2

How would you setup a regex for an UP TO 14 digits-telephone_number ?

I tried this : regex(., ‘^[0-9]{≤14}$’)
I also tried this : regex(., ‘^[0-9]{<=14}$’)
…but none seem to work. … Syntax issue.

Any hints would be much appreciated

:slight_smile:

Hi @alienationfreez,

regex(., ‘^[0-9]{1,14}$’) should do the trick.

1 Like

Thanks a lot, Hakan !

It’s perfect !

I presume this is the place where to look up for the syntax :

Considering that “range” is here only described in the context of questions, what would be the keywords to look at and where is there any description of the correct syntax you suggested ? (Where do you have it from?)

I only found these expressions on the site, e. g. :
<= or =>



Therefor I thought <= or => would work, but they don’t.

Merci :slight_smile:

1 Like

Hi @alienationfreez,

You can use this help article to learn more about regex

https://support.kobotoolbox.org/restrict_responses.html

PS:

  • Range is a question type. It has nothing to do with regex or constraining answers :slight_smile:

Hello again, Hakan,

Merci ! It seems I was on the wrong support-platform :slight_smile:

I’ll dig deeper into it !

P.S:: And, yes, It makes sense, as the question_type is not like the restricting_topic.

1 Like