I am using Spring Integration. I get a string (payload) like below:
<Element>
<Sub-Element>5</Sub-Element>
</Element>
I need to test if above string starts with <Element><Sub-Element>
which is actually <Element>\r\n <Sub-Element>.
<int:recipient-list-router id="customRouter" input-channel="routingChannel">
<int:recipient channel="channel1" selector-expression="payload.startsWith('<Element><Sub-Element>')"/>
<int:recipient channel="channel2" selector-expression="!payload.startsWith('<Element><Sub-Element>')"/>
</int:recipient-list-router>
Ideally the first router should pass the test but in this case its failing. Can anyone help me finding out what is the SpEL equivalent of \r \n etc ?
Thanks Gary. So the working list-recipient-router looks like
Either
<recipient selector-expression="payload matches '(?s)<Element>(\s*)<Sub>(.*)'" channel="channel1"/>
<recipient selector-expression="!(payload matches '(?s)<Element>(\s*)<Sub>(.*)')" channel="channel2"/>
Or
<recipient selector-expression="payload matches '(?s)<Element>(.*)<Sub>(.*)'" channel="channel1"/>
<recipient selector-expression="!(payload matches '(?s)<Element>(.*)<Sub>(.*)')" channel="channel2"/>
May keep captures ()
or may not. Both works.