diff --git a/data-explorer/kusto/query/extract-function.md b/data-explorer/kusto/query/extract-function.md index 059b5e08cd..6111564b8f 100644 --- a/data-explorer/kusto/query/extract-function.md +++ b/data-explorer/kusto/query/extract-function.md @@ -40,21 +40,27 @@ The following example extract the username, email, age from the string. The [reg :::moniker range="azure-data-explorer" > [!div class="nextstepaction"] -> Run the query +> Run the query ::: moniker-end ```kusto -let Text = "User: JohnDoe, Email: johndoe@example.com, Age: 29"; -print UserName = extract("User: ([^,]+)", 1, Text), -EmailId = extract(@"Email: (\S+),", 1, Text), -Age = extract(@"\d+", 0, Text) +let _data = datatable(Text: string) +[ +"User: James, Email: James@example.com, Age: 29", +"User: David, Age: 35" +]; +_data | +extend UserName = extract("User: ([^,]+)", 1, Text), + EmailId = extract(@"Email: (\S+),", 1, Text), + Age = extract(@"\d+", 0, Text) ``` **Output** -| UserName | EmailId | Age | -| --- | --- | --- | -| JohnDoe | johndoe@example.com | 29 | +| Text | `UserName` | `EmailId` | `Age` | +| -- | --- | --- | --- | +| User: James, Email: James@example.com, Age: 29 | James | James@example.com | 29 | +| User: David, Age: 35 | David | | 35 | The following example extracts the month from the string `Dates` and returns a table with the date string and the month as int type. @@ -77,7 +83,7 @@ Dates **Output** -| DateString | Month | +| DateString | `Month` | | --- | --- | | 15-12-2024 | 12 | | 21-07-2023 | 7 |