[Solved] jq case insensitive contains [closed]


It often suffices to convert both strings to the same typographical case using ascii_upcase or ascii_downcase, as in your case:

.user | ascii_downcase | contains("thinking")

If you want to test for equality of strings, ignoring (ASCII) case, you would write something along the lines of:

(S|ascii_upcase) == (T|ascii_upcase)

If you wanted to test for equality ignoring case more generally, then you should consider anchoring the regex, e.g.

.user | test("^thinking$"; "i")

Finally, in light of some of the comments, please also note that S | contains(T) does a substring match when S and T are both strings.

4

solved jq case insensitive contains [closed]