contains_cs operator
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Filters a record set for data containing a case-sensitive string. contains_cs
searches for arbitrary sub-strings rather than terms.
The following table compares the contains
operators using the abbreviations provided:
- RHS = right-hand side of the expression
- LHS = left-hand side of the expression
Operator | Description | Case-Sensitive | Example (yields true ) |
---|---|---|---|
contains |
RHS occurs as a subsequence of LHS | No | "FabriKam" contains "BRik" |
!contains |
RHS doesn't occur in LHS | No | "Fabrikam" !contains "xyz" |
contains_cs |
RHS occurs as a subsequence of LHS | Yes | "FabriKam" contains_cs "Kam" |
!contains_cs |
RHS doesn't occur in LHS | Yes | "Fabrikam" !contains_cs "Kam" |
For more information about other operators and to determine which operator is most appropriate for your query, see datatype string operators.
Performance tips
Note
Performance depends on the type of search and the structure of the data. For best practices, see Query best practices.
If you're looking for a term, use has_cs
for faster results.
Syntax
T |
where
col contains_cs
(
string)
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
T | string |
✔️ | The tabular input whose records are to be filtered. |
col | string |
✔️ | The name of the column to check for string. |
string | string |
✔️ | The case-sensitive string by which to filter the data. |
Returns
Rows in T for which string is in col.
Example
StormEvents
| summarize event_count=count() by State
| where State contains_cs "AS"
Output
Count |
---|
8 |