Krishna Murthy
Krishna Murthy

Reputation: 65

Filename pattern validation in adf v2

I would like to validate my input filename whether it's in specified name. Like my filename should be <><><>_<>.csv

Yes i am using event based i will get filename from trigger.

expected format: company_contry_yearmonth_timestamp.CSV

Upvotes: 0

Views: 2601

Answers (1)

KarthikBhyresh-MT
KarthikBhyresh-MT

Reputation: 5044

There is no explicit regex way of validating if the incoming file name matches a pattern. But if you are using activity like lookup or copy activity. You can specify in the source dataset settings a wildcard file name or file path to fetch a file matching the pattern.

- wildcardFileName

The file name with wildcard characters under the given container and folder path (or wildcard folder path) to filter source files. Allowed wildcards are: * (matches zero or more characters) and ? (matches zero or single character). Use ^ to escape if your file name has a wildcard or this escape character inside. See more examples in Folder and file filter examples.

example:

You can use a if condition, with an expression as below using contains()

Here a storage event trigger, gets the trigged file name into a parameter. We then use contains() function to see if the file name contains a specified string

@contains(pipeline().parameters.filenameTriggered,'pattern')

enter image description here

enter image description here

If true a wait activity is executed.

enter image description here

Upvotes: 1

Related Questions