- Posts: 409
- Thank you received: 34
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Regular Expression to allow french text as well as english text?
- blocka
- Topic Author
- Offline
- Platinum Member
Less
More
4 years 6 months ago #189158
by blocka
Regular Expression to allow french text as well as english text? was created by blocka
I have a question entitled "Last Name" -- I want to make the field Mandatory, and use a regular expression to restrict the input to only letters, dashes, and apostrophe (letters must allow for foreign characters as well -- like French accented characters, etc).
I checked here: manual.limesurvey.org/Using_regular_expressions , but there are no examples for this scenario.
Can anyone provide a regex that will prevent a question from being submitted if it doesn't meet the above?
I checked here: manual.limesurvey.org/Using_regular_expressions , but there are no examples for this scenario.
Can anyone provide a regex that will prevent a question from being submitted if it doesn't meet the above?
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
4 years 6 months ago #189164
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Regular Expression to allow french text as well as english text?
Maybe best question is : what is disallowed ?
For example to allow only non white-space you can use /^(\S)*$/ .
But to disallow specific c&aracter : /^([^\s|!|?|\.]|)*$/
For example to allow only non white-space you can use /^(\S)*$/ .
But to disallow specific c&aracter : /^([^\s|!|?|\.]|)*$/
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- blocka
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 409
- Thank you received: 34
4 years 6 months ago #189169
by blocka
Replied by blocka on topic Regular Expression to allow french text as well as english text?
Thanks Denis, generally I would agree, but we have to limit our input to only French or English characters.
We've tried both:
/^[a-zA-ZÀÂÉÊÈËÌÏÎÔÙÛÇÆŒàâéêèëìïîôùûçæœ '-]{3,100}$/
and
/^[^@!#$%^&?*+=_0-9~`:;\"<>[\]{}\/\\]{3,100}$/
Both of which work on regex101.com but don't work in the validation field in LS3
Any help that can be provided is greatly appreciated.
We've tried both:
/^[a-zA-ZÀÂÉÊÈËÌÏÎÔÙÛÇÆŒàâéêèëìïîôùûçæœ '-]{3,100}$/
and
/^[^@!#$%^&?*+=_0-9~`:;\"<>[\]{}\/\\]{3,100}$/
Both of which work on regex101.com but don't work in the validation field in LS3
Any help that can be provided is greatly appreciated.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
4 years 6 months ago - 4 years 6 months ago #189174
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Regular Expression to allow french text as well as english text?
Ah, yes … just checked …
Your expression is OK in PHP but not in JS, because js encode htmlentities when get value.
Can you try with
regexMatch("/^[a-zA-ZÀÂÉÊÈËÌÏÎÔÙÛÇÆŒàâéêèëìïîôùûçæœ '-]{3,100}$/",html_entity_decode(self.NAOK))
PS : it can be great to report the issue :
LemVal must encode only when view, but not when used in another function (for example strlen(self.NAOK) with é return 8 …
Your expression is OK in PHP but not in JS, because js encode htmlentities when get value.
Can you try with
regexMatch("/^[a-zA-ZÀÂÉÊÈËÌÏÎÔÙÛÇÆŒàâéêèëìïîôùûçæœ '-]{3,100}$/",html_entity_decode(self.NAOK))
PS : it can be great to report the issue :
LemVal must encode only when view, but not when used in another function (for example strlen(self.NAOK) with é return 8 …
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 4 years 6 months ago by DenisChenu. Reason: PS
The topic has been locked.
- blocka
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 409
- Thank you received: 34
4 years 6 months ago #189190
by blocka
Replied by blocka on topic Regular Expression to allow french text as well as english text?
Thank you for your continued support.
I copied the expression into the validation field and tried again, but it still doesn't appear to work.
This is what I have in my validation field:
I've also attached my question.
I copied the expression into the validation field and tried again, but it still doesn't appear to work.
This is what I have in my validation field:
I've also attached my question.
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5070
- Thank you received: 1263
4 years 6 months ago #189191
by jelo
Not still planned?
manual.limesurvey.org/Expression_Manager..._or_Being_Considered
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Regular Expression to allow french text as well as english text?
Is Regexmatch available in ExpressionScript / ExpressionManager?DenisChenu wrote: Can you try with
regexMatch("/^[a-zA-ZÀÂÉÊÈËÌÏÎÔÙÛÇÆŒàâéêèëìïîôùûçæœ '-]{3,100}$/",html_entity_decode(self.NAOK))
:
Not still planned?
manual.limesurvey.org/Expression_Manager..._or_Being_Considered
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
4 years 6 months ago #189194
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Regular Expression to allow french text as well as english text?
Not in validation, in
Question validation equation
See sample (with strlen to show the issue)
@jelo : no, included since … 1.98 i think ?
See sample (with strlen to show the issue)
@jelo : no, included since … 1.98 i think ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- blocka
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 409
- Thank you received: 34
4 years 6 months ago #189197
by blocka
Replied by blocka on topic Regular Expression to allow french text as well as english text?
@DenisChenu Oh wow! Fantastic, that totally works. Thank you so much for helping out!
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5070
- Thank you received: 1263
4 years 6 months ago #189203
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Regular Expression to allow french text as well as english text?
Thanks, the English manual already list the function as implemented. The GERMAN manual page is outdated. Sorry.DenisChenu wrote: @jelo : no, included since … 1.98 i think ?
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11758
- Thank you received: 2753
4 years 6 months ago #189208
by holch
First of all, the manual is always behind the actual software. Then imagine a manual page that has to be translated from the original manual page...
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Regular Expression to allow french text as well as english text?
Why would you read anything else than the English manual, if you know English?The GERMAN manual page is outdated. Sorry.
First of all, the manual is always behind the actual software. Then imagine a manual page that has to be translated from the original manual page...
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.