Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Removes leading match of the specified regular expression.
trim_start(
regex,
source)
Learn more about syntax conventions.
Name | Type | Required | Description |
---|---|---|---|
regex | string |
✔️ | The string or regular expression to be trimmed from the beginning of source. |
source | string |
✔️ | The source string from which to trim regex. |
source after trimming match of regex found in the beginning of source.
The following example trims substring from the start of string_to_trim.
let string_to_trim = @"https://bing.com";
let substring = "https://";
print string_to_trim = string_to_trim,trimmed_string = trim_start(substring,string_to_trim)
Output
string_to_trim | trimmed_string |
---|---|
https://bing.com | bing.com |
The following example trims all non-word characters from the beginning of the string.
range x from 1 to 5 step 1
| project str = strcat("- ","Te st",x,@"// $")
| extend trimmed_str = trim_start(@"[^\w]+",str)
Output
str | trimmed_str |
---|---|
- Te st1// $ | Te st1// $ |
- Te st2// $ | Te st2// $ |
- Te st3// $ | Te st3// $ |
- Te st4// $ | Te st4// $ |
- Te st5// $ | Te st5// $ |
The following example trims all spaces from the start of the string.
let string_to_trim = @" Hello, world! ";
let substring = @"\s+";
print
string_to_trim = string_to_trim,
trimmed_start = trim_start(substring, string_to_trim)
Output
string_to_trim | trimmed_start |
---|---|
Hello, world! | Hello, world! |