Regular expression I'm having problem with

Hello,

I’m having problems with regular expression. How can I achieve this?

The only allowed characters are alphabets (uppercase and lowercase), numbers, hypen, period, comma and it cannot begin or end in either space or line break.

EDIT: It should also allow ñ and Ñ

Thanks!

Does it require a space in the middle? Could you provide an example of some input so that it would give us a clue on how it should look like.

Space in the middle is allowed. But space in front and end is not allowed also with line breaks.

Example: person names like George Clooney, or maybe address.

EDIT: It should also allow ñ and Ñ

Thanks

Is there any word limit/character limit for the same?

There is a 255 limit for characters but I’ve implemented a different approach; a combination of string-length(.) and regex on the constraint column.

Would you mind trying this as outlined in the image below (it should solve your issue):

In the survey tab of your xlsform:

Image 1

Data entry screen as seen in Enketo: With space in the beginning

Image 2

Data entry screen as seen in Enketo: Without space in the beginning

Image 3

Reference xlsform:

Regex.xlsx (10.1 KB)

1 Like