Use the FileNameHexRe("<hexlified regex string>") in advanced pattern to match the file name with the specified regex. The FileNameHexRe("<hexlified regex string>") accepts a hex
encoded form of regular expression for file name.
Follow the steps below to create an Advanced DLP pattern using the FileNameHexRe function with the hexlified value of file name. The advanced data pattern can be used to configure a
secure access policy for the application using inline DLP.
Steps
-
Find the Hexlify Value of the File Type:
Use the python online tool to get its hexlified value
for the file type.
The following code is an example of how to get the hexlify value using the online python interpreter for .csv and .psd files:
import binascii
print(binascii.hexlify(b'\\.(csv|psd)$'))
Output returned = 5c2e286373767c7073642924
The FileNameHexRe function and its value can be used in an Advanced Data Pattern to match against a particular file name as below:
Prototype: FileNameHexRe(<hex encoded regex pattern>)
Replace <hex encoded regex pattern>
with regex pattern encoded as a hexadecimal string.
Example: FileNameHexRe("5c2e286373767c7073642924")
The above function would return mime-types matching application/pdf.
-
Navigate to .
-
Click the green plus icon and select Advanced to create the data pattern.
-
Enter a name that is recognizable at the top. You can also provide a description for what the pattern is doing.
-
On the Match Criteria tab, enter the hexlify value for your file type in Expression in
FileNameHexRe("xxxxxxxxxxxxxxx") format and save it.
-
Testing the pattern with a .csv file displays Match Successful! Verdict.
The Match Successful! verdict is displayed only when the file name is present in Content-Disposition header field.