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”
regex("\/*\/*abgeschlossen", to_string($message.http_request_uri_normalized)).matches == true

See attached picture for the error in the editor.


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) closed #3

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