Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

ASCII characters only validation in "Long free text"

More
6 years 3 months ago #161829 by kaz_k
Hi, LimeSurvey all stars,

I want to restrict the input valid characters only to ASCII ones, ie. 0x20-0x7e.

I think it works for Short free text field (please refer Note below).

But I have difficulties for Long free text field.
I made a validation of "/^[\n\r !-~]+$/gis".
But It accepts Kanji (Japanese) characters. It seems that any restriction does not work.
(Please refer the attached screen copy. The bottom is the result.)

I consulted regex101.com/ and found that "/^[\n\r !-~]+$/gis" seems to work. I could type statements of several lines with only ASCII characters with a match of the whole text. When I insert Kanji (Japanese) character, the whole input is invalid (not match).

Does anyone have an idea and/or help ?
Any comments welcome.

Note: I made a validation of "/^[ !-~]+$/" for Short free text field.
It works well.
Attached screen copy shows the results.
Topmost question and middle one have same validation definition of "/^[ !-~]+$/".
Kanji (Japanese) are input in the topmost question and it shows the input is inappropriate(red line and red message).
Only 0x20-0x7e characters are input in the middle question and it shows the input is appropriate(red line and red message).
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose