Berserk Docs
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 pattern

Parse and filter in one step

Parameters

NameDescription
columnString column to parse
patternPattern with * wildcards and name:type captures

Syntax

parse-where kind=mode [flags=regexFlags] column with pattern

Parse with specified mode and filter

Parameters

NameDescription
columnString column to parse
patternPattern with * wildcards and name:type captures

kind=

Parse mode

ValueDescription
simpleDefault. Strict match with regular string delimiters.
regexString constants are regular expressions.
relaxedLike simple, but type mismatches produce null instead of failing.

flags=

Regex flags (only with kind=regex)

ValueDescription
UUngreedy
mMulti-line mode
sDot matches newline
iCase-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 Ragnar793LindisfarneRagnar
845 raid on Paris by Bjorn845ParisBjorn

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 80Naglfar80
ship Wave Rider crew 45Wave Rider45

On this page