Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions data-explorer/kusto/query/extract-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,27 @@ If there's no match, or the type conversion fails: `null`.

## Examples

The following example extracts the month from the string `Dates` and returns a table with the date string and the month.
The following example extract the username, email, age from the string. The regular expressions are used to extract the information.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAA8tJLVEISa0oUbBVUAotTi2yUvDKz8hzyU%2FVUXDNTczMsVLIAvJT8lMdUisScwtyUvWS83N1FBzTU60UjCyVrLkKijLzShRAWv0Sc1OBxgANK0pMLtGAGqcRHacTq62ppKNgqAO2SVOHC2yyZwqSYgclqG0aMcHamjooqoF2oaiMSdEGyhtA5QFR4bA2wQAAAA%3D%3D" target="_blank">Run the query</a>
::: moniker-end

```kusto
let Text = "User: JohnDoe, Email: [email protected], Age: 29";
print UserName = extract("User: ([^,]+)", 1, Text),
EmailId = extract(@"Email: (\S+),", 1, Text),
Age = extract(@"\d+", 0, Text)
```

**Output**

| UserName | EmailId | Age |
| --- | --- | --- |
| JohnDoe | [email protected] | 29 |

The following example extracts the month from the string `Dates` and returns a table with the date string and the month as int type.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
Expand All @@ -63,24 +83,6 @@ Dates
| 21-07-2023 | 7 |
| 10-03-2022 | 3 |

The following example returns the username from the string. The regular expression `([^,]+)` matches the text following "User: " up to the next comma, effectively extracting the username.

:::moniker range="azure-data-explorer"
> [!div class="nextstepaction"]
> <a href="https://dataexplorer.azure.com/clusters/help/databases/Samples?query=H4sIAAAAAAAAA8tJLVEISa0oUbBVUAotTi2yUvDKz8hzyU%2FVUXDNTczMsVLIAvJT8lMdUisScwtyUvWS83N1FBzTU60UjCyVrLkKijLzShRAWv0Sc1OBxgANK0pMLtGAGqcRHacTq62ppKNgqAO2SRMAAQTyB3MAAAA%3D" target="_blank">Run the query</a>
::: moniker-end

```kusto
let Text = "User: JohnDoe, Email: [email protected], Age: 29";
print UserName = extract("User: ([^,]+)", 1, Text)
```

**Output**

| UserName |
| --- |
| JohnDoe |

## Related content

* [extract-all function](extract-all-function.md)
Expand Down
6 changes: 5 additions & 1 deletion data-explorer/kusto/query/time-series-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ demo_series3

:::image type="content" source="media/time-series-analysis/time-series-seasonality.png" alt-text="Time series seasonality.":::

- Use [series_periods_detect()](series-periods-detect-function.md) to automatically detect the periods in the time series.
- Use [series_periods_detect()](series-periods-detect-function.md) to automatically detect the periods in the time series, where:
- `num`: the time series to analyze
- `0.`: the minimum period length in days (0 means no minimum)
- `14d/2h`: the maximum period length in days, which is 14 days divided into 2-hour bins
- `2`: the number of periods to detect
- Use [series_periods_validate()](series-periods-validate-function.md) if we know that a metric should have specific distinct period(s) and we want to verify that they exist.

> [!NOTE]
Expand Down