1
votes

Am using MULE file inbound endpoint to pickup only the csv files for processing. Couldn't figure out how to specify the regex pattern of the file name. It would be better if I can specify the first few characters of the file name as well e.g. in_*.csv (file name should start with in_ and should be a csv file)

Right now, I have specified like this. file:filename-regex-filter pattern=".csv" caseSensitive="false"

But not working. Can somebody help me out in finding the right syntax for this?

2

2 Answers

4
votes

This should do it:

in_(.*).csv

() encloses an expression

. matches any single character

* matches 0 or more repeats of the preceding expression

So this means "match the start and end of the string, and allow any number of any characters in-between". There are plenty of regex tutorials and online regex matching test tools, if you need more complex expressions.

2
votes

in_(.*).csv

() is regex grouping operator

in_(.*).csv , in_.*.csv and in_.*csv matches similar

escape . if you want to specify that, because the last . matches any char also

example: in_.*\.xml