value - Parse values
Added in version pltOS: v2.0.30
Extract data from a value.
Usage:
- command: value <payloadText>
[expect: [hex] <expectText>]
[extract: <extractText>]
[extractKey: <key>...]
Argument |
Description |
|---|---|
payloadText |
Value to check and/or extract from. |
expectText |
Text that must appear anywhere in payloadText
(substring match), checked before extraction; the
step fails if it is not found. If the |
extractText |
Regular expression to extract (uses RE2 Syntax, except |
key |
Key(s) in which to store extracted text. To save multiple values, use multiple capture groups. |
With no expect: or extract:, the step passes and its result value
is payloadText unchanged. If extract: is given but the regular
expression does not match payloadText, the step fails.
extractKey: values are assigned to capture groups positionally (the
first key gets the first capture group, and so on) and stored as test
plan keys, the same store used by define - Define user key — making them usable by
later eval - Evaluate Expression or label - Set Label Substitutions steps. If more keys are given than the
regular expression has capture groups, the step fails.
Examples
# Extract 2 capture groups
- command: define TEXT "Foobar1234"
- command: value "%TEXT%"
extract: "^(\\D+)(\\d+)$"
extractKey: ALPHA DIGITS
# Match hex values
- command: value "ABC"
expect: hex 414243