The case-insensitive =~ (equals) string operator

Learn how to use the =~ (equals) operator to filter a record set for data with a case-insensitive string.

Filters a record set for data with a case-insensitive string.

The following table provides a comparison of the == (equals) operators:

OperatorDescriptionCase-SensitiveExample (yields true)
==EqualsYes"aBc" == "aBc"
!=Not equalsYes"abc" != "ABC"
=~EqualsNo"abc" =~ "ABC"
!~Not equalsNo"aBc" !~ "xyz"

For more information about other operators and to determine which operator is most appropriate for your query, see datatype string operators.

Performance tips

When possible, use == - a case-sensitive version of the operator.

Syntax

T | where col =~ (expression)

Parameters

NameTypeRequiredDescription
Tstring✔️The tabular input whose records are to be filtered.
colstring✔️The column to filter.
expressionstring✔️The expression used to filter.

Returns

Rows in T for which the predicate is true.

Example

The State values in the StormEvents table are capitalized. The following query matches columns with the value “KANSAS”.

StormEvents
| where State =~ "kansas"
| project EventId, State

The following table only shows the first 10 results. To see the full output, run the query.

EventIdState
70787KANSAS
43450KANSAS
43451KANSAS
38844KANSAS
18463KANSAS
18464KANSAS
18495KANSAS
43466KANSAS
43467KANSAS
43470KANSAS