Welcome to the LimeSurvey Community Forum

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

Can I use the /ig switch on regular expressions in Relevance equations

  • rsmokeUM
  • rsmokeUM's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 weeks ago #149405 by rsmokeUM
I am trying to check for text input that has any of a specific set of words in upper or lower case. The Relevance equation I am using is:

regexMatch("/(show|privatize|worried)/ig", G3Q00051.NAOK)

I expect this to match any of these entries in a text box:
show
Show
ShoW
SHOW
privatize
Privatize
worried
Worried

I am unable to get the /g switch to be accepted as valid perl regex. any ideas?
The topic has been locked.
More
7 years 2 weeks ago #149411 by jelo
Which version/build of LimeSurvey is used?
We had some bugs around RegExp before.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 weeks ago - 7 years 2 weeks ago #149430 by tpartner
Yep, that seems to be broken, please file a bug report .

In the meantime, try using the strtolower() function to convert the input value to lowercase before testing:

Code:
{regexMatch("/^(show|privatize|worried)$/", strtolower(G3Q00051.NAOK))}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 2 weeks ago by tpartner.
The following user(s) said Thank You: rsmokeUM
The topic has been locked.
  • rsmokeUM
  • rsmokeUM's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 weeks ago - 7 years 2 weeks ago #149434 by rsmokeUM
The Limesurvey version I use is Version 2.63.1+170305
(I know better than to place a help message without including the operating details )

using strtolower is the solution. I look forward to the switch support so I can use the global (/g) switch too. I'll file a bug report.

regexMatch("/(show|atmosphere|diag|vibe)/i", strtolower(G2Q00082.NAOK))

Thanks!!
Last edit: 7 years 2 weeks ago by rsmokeUM.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 weeks ago #149441 by DenisChenu
Maybe it's fixed here : github.com/LimeSurvey/LimeSurvey/commit/...32b9bfff58c6c253fdb1

For next release.

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 following user(s) said Thank You: rsmokeUM
The topic has been locked.
  • rsmokeUM
  • rsmokeUM's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 2 weeks ago #149448 by rsmokeUM
It looks like it is fixed there, thanks!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 2 weeks ago #149526 by DenisChenu
Thanks Carsten, not me ;)

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.

Lime-years ahead

Online-surveys for every purse and purpose