onlydarksets

Just another WordPress.com weblog

HowTo: ChangeContextValue regular expressions

Posted by onlydarksets on January 15, 2008

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: