Writing valid RegEx for use in file/folder exclusion

The link you posted says:

The Code42 app treats all file separators as forward slashes /.

So it seems you’d want to use / instead of \\ in your regular expressions.

Colon doesn’t need escaping.

\ needs escaping because it’s the escaping character itself.

/ normally needs escaping because it is the default separators for regular expression sections. However, the examples in your link don’t escape it, so only the matching section is implied, so no escaping.

Then you could probably use:

  1. S:/Google Drive/Temp or [A-Z]:/Google Drive/Temp (to allow any drive)
  2. .*Backup_Excluded.*

I probably wouldn’t use (?i), as the capitals in those strings are usually there, but that’s your call.

Check out e.g. https://regex101.com/ to test your regular expressions (also in different flavours).

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top