Syntax: regex replacement in Pipeline Rule

Hello && Welcome

I might be able to help. Just and FYI I’m not very good at pipelines /w regex but I did find some flaws.
It should look some thing like this.

rule "R-DeviceID Regex Replacement"

when
    has_field("R-DeviceID")
then
    let N-DeviceID = regex_replace("(\d)(/\d)\/(\d+)\/(\d+)\:(\d+)\.(\d+)\.(\d+),to_string($message.R-DeviceID), "$3-$4-$5-$6-$7");
    set_field = ("R-DeviceID", N-DeviceID);
end

Next, I copy & paste you configuration above in Pipeline rules and there is an error with the regex section, Invalid expression.

I was testing regex configuration that could work here https://regex101.com/

Regex you have used above.

One I have used.

But when replacing regex with the one I tested an error Invalid expression still shows .

Using this rule.

rule "R-DeviceID Regex Replacement"

when
    has_field("R-DeviceID")
then
    let N-DeviceID = regex_replace("[^<>,\s]+(\d+)\:(\d+)\.(\d+)\.(\d+),to_string($message.R-DeviceID), "$3-$4-$5-$6-$7");
    set_field = ("R-DeviceID", N-DeviceID);
end

Think were forgetting something but not sure what. @tmacgbay probably be our best bet to find out what this could be.

I found this post, it might help with the pipeline.

I just ran into something I totally forgot. There is a regex extractor called Replace with regular expression

2 Likes