Constraint Surname and first name of an individual

Hi everyone, Can you help me to force the entry of the Surname and the 1st letter of the first name of an individual in Capital letters in a form

@tuumaprojectdata, have you gone through our support article Restricting Text Responses With Regular Expressions? It should help you solve your issue.

Maybe you could focus to this section of the article:

1 Like

Yes I read it but my problem is not solved. I would like the names of the respondents to be written like this: Kobe BRYANT

Hello @tuumaprojectdata,

You can use the following regex function:

regex(., '^[A-Z]{1}[a-z]{1,}[ ]{1}[A-Z]{1,}$')

You need to put this for the validation code.

1 Like

OK, I’ll try it and see. Thank you

1 Like

My problem persists with your proposal

Hi @tuumaprojectdata,

I thought you use Name SURNAME as your format. In SURNAME Name format you can use this one:

regex(., '^[A-Z]{1,}[ ]{1}[A-Z]{1}[a-z]{1,}$')

1 Like

Thank you, the problem is partially solved if the person has only one first name; but if she has several first names the code does not work anymore

Hi @tuumaprojectdata,

In that case you can try this one: :slight_smile:

regex(., '^([A-Z]{1,}\s)([A-Z]{1}[a-z]{1,}\s?)+$')

1 Like

It is resolved. Thank you. Also, can you help me code the numbers and date of the identity documents? in example: B12764538 of 15/09/2018

Hi Hakan,

This is Priyanka here. I want name to be entered only in capital letter. It can be 2 or 3 or 4 or 5 or 6 words in the name of the participant.
example: REEMA MISHRA OR REEMA DEVI MISHRA OR REEMA DEVI SHARMA MISHRA.
I used the following regex but and it allow 3 words in name eg REEMA DEVI MISHRA.
regex(., ‘^[A-Z]{1,}[ ][A-Z]{1,}[ ][A-Z]{1,}$’)

so my problem here is, some time it can be 2 words sometimes 3 or 4 or 5 so in this case what should be my regex?

Please help me on this.

Hi @Priyanka,

Following should work: :slight_smile:

regex(., '^[A-Z\W]+$')

Best,

1 Like

Thank you Hakan!

It is working.

regex(., ‘^[A-Z\s]+$’) works too.

2 Likes