Skip to content

Expressions: The contains operator ignores the case sensitivity setting #10784

@JaneSjs

Description

@JaneSjs

T26065 - Is there any built-in-function available in a Survey JS to make the question value as lowercase or uppercase?
https://surveyjs.answerdesk.io/internal/ticket/details/T26065

The = operator is case-insensitive by default and can be made case-sensitive by enabling the settings.comparator.caseSensitive option. However, the contains operator is always case-sensitive.

@andrewtelnov Could you please clarify whether the contains operator is intentionally case-sensitive by default because it is typically used for substring matching and is expected to be strict, as lowercasing everything might hide real differences or create unexpected matches?

Example 1: Use =

{
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "text",
          "name": "question1"
        },
        {
          "type": "text",
          "name": "question2",
          "visibleIf": "{question1} = 'TEST'"
        }
      ]
    }
  ]
}

Example 2: Use contains

{
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "text",
          "name": "question1"
        },
        {
          "type": "text",
          "name": "question2",
          "visibleIf": "{question1} contains 'TEST'"
        }
      ]
    }
  ]
}

Metadata

Metadata

Assignees

Labels

buguser issueAn issue or bug reported by users

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions