Regex Parser
The Regex parser is used for parsing incoming data using regular expressions. To use it set engine
to regex
and use regular expressions in your schema’s source
.
For more information about the syntax visit https://github.com/google/re2/wiki/Syntax.
To test your regular expressions we recommend using https://regex101.com/ and selecting the
Golang
flavour.
Example
Optimus task config:
tasks:
- task: parse
input: The URL http://example.com/foo has been visited 2835 times.
engine: regex
schema:
type: object
properties:
url:
type: string
source: ^The URL (.*) has
visits:
type: integer
source: \d+
Outputs:
url: http://example.com/foo
visits: 2835