Hello,
From what I understand from several places (e.g. there: Can a pipeline rule to match the same pattern multiple times?), if a group in my regex happens several times in the original string, I should be able to get several matches. However, I’m not, so there’s something I must misunderstand. For example, here’s a very basic example of a rule, input, and what I get in the pipeline simulator:
rule:
when
has_field("test")
then
let result = regex("([0-9])", to_string($message.message));
set_field("result_0", result["0"]);
set_field("result_1", result["1"]);
set_field("full_result", to_string(result));
end
input:
{
"test": 1,
"message": "hel 1 flrj 4 l3j4 9",
"timestamp": 1
}
So I would expect the field result_0 to be 1, and the field result_1 to be 4, and the field full_result to be a string representation of the map containing everything. Instead, this is what I get from the pipeline simulator:
Added fields
full_result
{0=1}
test_result_0
1
Hence, it seems only the first match is considered. What am I understanding wrongly?
Thanks!