Issue
The regular expression used for files starting with a string is not matching files.
Environment
All file connectors.
Resolution
There can be several ways of specifying a regex for files that start with a given string. Since one can specify the folder in which they are located and the string they should match in the Regex pattern.
The character ^
generally specifies the string start in a regex expression, but depending on your setup, this might not work as you expect. Find below three examples to illustrate how you should set up your connector:
Example A
Files are in the root. For example, if you had the following directory:
/abc.csv
/acb.csv
/bac.csv
/bca.csv
/cab.csv
/cba.csv
To match all files in the root that start with 'a', you could use the following:
- prefix: None
- pattern: "^a[b|c]+.csv"
Example B
Folders are nested in some folders and the path is not specified in the connector setup.
For example, if you had the following directory:
/path/to/abc.csv
/path/to/acb.csv
/path/to/bac.csv
/path/to/bca.csv
/path/to/cab.csv
/path/to/cba.csv
To match all files in the root that start with 'a', you could use the following:
- prefix: None
- pattern: "^path/to/a[b|c]+.csv"
Example C
Folders are nested and the path is specified in the connector setup. For example, if you had the following directory:
/path/to/abc.csv
/path/to/acb.csv
/path/to/bac.csv
/path/to/bca.csv
/path/to/cab.csv
/path/to/cba.csv
To match all files in the root that start with 'a', you could use the following:
- prefix: /path/to/
- pattern: "^a[b|c]+.csv"