Named capture groups in change node's regex

Please have a look at this flow

[{"id":"1702a6eb.de8499","type":"inject","z":"ddd38a48.2e949","name":"","topic":"","payload":"abc1234abc","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1100,"wires":[["d59e679b.d56998"]]},{"id":"d59e679b.d56998","type":"change","z":"ddd38a48.2e949","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"(?[0-9]+)","fromt":"re","to":"XX${number}XX","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":1100,"wires":[["c77e8493.720b68"]]},{"id":"c77e8493.720b68","type":"debug","z":"ddd38a48.2e949","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":800,"y":1100,"wires":}]

We insert string "abc1234abc"
in Regex wie search vor the number via "(?[0-9]+)"
Now I want to have the output "abcXX1234XXabc"
With replacing by "XX$1XX" this works.
However I want to use the named capture group. How can this be done?
Using "XX$numberXX" leads to "abcXX$numberXXabc"

Thanks for your support in advance.

You forgot to name the capture group. Also, when using the named group, don't use parentheses (I think that is Perl).

So (?[0-9]+) should be (?<number>[0-9]+)
And XX${number}XX should be XX$<number>XX

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