Query Details

Stringtoregex Deprecated

Query

// this code can be substituted by regex_quote()
let _StringToRegEx = toscalar(
    _GetWatchlist('RegEx-SingleRegularExpressions')
    | where UseCase == "StringToRegEx"
    | project RegEx
);
// ...
| project RegEx = replace_regex(ToReplace, _StringToRegEx, @"\\\1")

Explanation

This query is using the Kusto Query Language (KQL) to replace a specific pattern in a string with a regular expression. It first retrieves the regular expression from a watchlist, then uses the "replace_regex" function to perform the replacement. The result is a modified string with the pattern replaced.

Details

Jose Sebastián Canós profile picture

Jose Sebastián Canós

Released: March 7, 2023

Tables

_GetWatchlist

Keywords

KQL,Query,Keywords,Devices,Intune,User,RegEx,StringToRegEx,ToReplace

Operators

replace_regextoscalar_GetWatchlistwhereproject

Actions