Tabular OperatorsParse Operators
parse-where
Extracts structured data from a string column and filters out rows where the pattern does not match.
Extracts structured data from a string column and filters out rows where the pattern does not match. Combines the functionality of parse and where operators.
Syntax
parse-where column with patternParse and filter in one step
Parameters
| Name | Description |
|---|---|
| column | String column to parse |
| pattern | Pattern with * wildcards and name:type captures |
Syntax
parse-where kind=mode [flags=regexFlags] column with patternParse with specified mode and filter
Parameters
| Name | Description |
|---|---|
| column | String column to parse |
| pattern | Pattern with * wildcards and name:type captures |
kind=
Parse mode
| Value | Description |
|---|---|
simple | Default. Strict match with regular string delimiters. |
regex | String constants are regular expressions. |
relaxed | Like simple, but type mismatches produce null instead of failing. |
flags=
Regex flags (only with kind=regex)
| Value | Description |
|---|---|
U | Ungreedy |
m | Multi-line mode |
s | Dot matches newline |
i | Case-insensitive |
See Regex Syntax for the regular expression reference used with kind=regex.
Examples
Example 1
datatable(log:string)[
"793 raid on Lindisfarne by Ragnar",
"845 raid on Paris by Bjorn",
"not a raid log",
"storm at sea"
]
| parse-where log with year:long " raid on " target " by " leader| log (string) | year (long) | target (string) | leader (string) |
|---|---|---|---|
| 793 raid on Lindisfarne by Ragnar | 793 | Lindisfarne | Ragnar |
| 845 raid on Paris by Bjorn | 845 | Paris | Bjorn |
Example 2
datatable(entry:string)[
"ship Naglfar crew 80",
"unknown vessel",
"ship Wave Rider crew 45"
]
| parse-where entry with "ship " name " crew " crew:long| entry (string) | name (string) | crew (long) |
|---|---|---|
| ship Naglfar crew 80 | Naglfar | 80 |
| ship Wave Rider crew 45 | Wave Rider | 45 |