HowTo: ChangeContextValue regular expressions

January 15th, 2008 | Categories: DVRMSToolbox | Tags:

I came up with a regular expression that should allow full access to the path, filename, and extension when using the ChangeContextValue Action. I’m sure there is a more efficient way to do it, but this works just fine.

FindRegex: ^((.*\\)(.*)\.(.*))\z

ReplaceRegex:

  • $1 = E:\Recorded TV\subdir\another one\Dirty Sexy Money_WJLA-DT_10_10_2007_22_00_01.dvr-ms
  • $2 = E:\Recorded TV\subdir\another one\
  • $3 = Dirty Sexy Money_WJLA-DT_10_10_2007_22_00_01
  • $4 = dvr-ms

So, if you want to change the extension, the ReplaceRegex value would be:

$2$3.wmv

If you want to change the path, the ReplaceRegex would be:

C:\New Path\$3.$4

I don’t suggest using this to change the filename (use the AdvancedFileRename Action instead). However, if you insist, the ReplaceRegex would be:

$2$3 (FIXED).$4

Comments are closed.