I am getting 17 types of file having following format:
85_*_p.dat
88_*_p.dat
32_*_p.dat
40_*_p.dat
41_*_p.dat
70_*_p.dat
22_*_p.dat
23_*_p.dat
46_*_p.dat
24_*_p.dat
25_*_p.dat
26_*_p.dat
52_*_p.dat
123_*_p.dat
28_*_p.dat
29_*_p.dat
35_*_p.dat
Where * is any GUID like "40_20200313_0cd6963f-bf5b-4eb0-b310-255a23ed778e_p.dat". The numbers like 85, 88 etc. are interface no. Underscores as well as "_p.dat" is common for all files.
How to write a regular expression which includes all of above files?
Tried but not worked:
/[22][23][24][25][26][28][29][32][35][40][41][46][52][70][85][88][123]_(?:.*)_p.dat/
Also tried:
\d[22|23|24|25|26|28|29|32|35|40|41|46|52|70|85|88|123]_(?:.*)_p.dat
This is errorneous as if i add 123 then it also picks 23
Also tried:
(22|23|123)_(?:.*)_p.dat
It is giving two results with normal and group 1
Not sure how to manage this
Note: Apache Camel has facility to read SFTP File through Regular Expressions. I wanted to create regular expressions for all above files. But need the same for Java.