1
votes

I'm using spring-integration-file to monitor a folder. I need to ignore files that have .inprogress as the file extension. The problem is the regular expression ^(.*(?<!\.inprogress))$ includes a character that's not allowed in the inbound-channel-adapter. Using it throws an exception

org.xml.sax.SAXParseException: The value of attribute "filename-regex" associated with an element type "file:inbound-channel-adapter" must not contain the '<' character.

Is there another way I can write the expression so that it doesn't use the '<' character or is there another way around this limitation?

I'm using the following: spring-integration-file 2.0.5.RELEASE Java 1.6

2

2 Answers

2
votes

You can avoid negative lookbehind by this negative lookahead regex:

^(?!.*\.inprogress$)(.*)$

RegEx Demo

1
votes

Also, if you need to declare a < in a String in the XML, use &lt;.