Regex in pipeline "when" not working


(Roman) #1

I am trying to match a message field to a regex but the pipeline rule editor does not let me save the pipeline rule.

have i done something wrong ?

rule source:

rule “route to stream abschluesse"
when
regex(”\/*\/*abgeschlossen", to_string($message.http_request_uri_normalized)).matches == true
then
route_to_stream(“streamid”);
end

See attached picture for the error in the editor.

pipelineRule

I am using version 2.4.2 (currently upgraded from 2.3.2 to see if it changes something).

Edit: If i am using an empty regex, the editor would let me save the rule…

regex("", to_string($message.http_request_uri_normalized)).matched == true


(Roman) #2

i will answer this myself.

I forgot to escape the backslashes in the pattern as stated in the docs:

Note: Patterns have to be valid Java String literals, please ensure you escape any backslashes in your regular expressions!

sorry for the unnecessary question


(system) #3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.