Page 1 of 1

With regexp replace can you get the match and use it?

Posted: 08 Mar 2015 00:05
by mydarkpassenger
Is it possible with the XYPlorer regexp rename to take a match and use the match info in a rename. For example, I'd like to clean up the name of a bunch of files so that they are formatted slightly different, for example capitalize certain parts of a file like s01e02 Episode and make it S01E02 - Episode. Is there a way to do this?

Re: With regexp replace can you get the match and use it?

Posted: 08 Mar 2015 05:02
by bdeshi
Yes. You capture a pattern with () and reuse the match using $1, $2 etc.
Here's an example of a regex pattern that reuses matched sections in $1 $2 $3

Code: Select all

s(\d+)e(\d+) (Episode.*) > S$1E$2 - $3

Re: With regexp replace can you get the match and use it?

Posted: 08 Mar 2015 16:45
by mydarkpassenger
Awesome thank you. Just wondering do you know if it's possible to recase the return data?

Re: With regexp replace can you get the match and use it?

Posted: 08 Mar 2015 16:59
by bdeshi
Sadly VB6 depends on VBScript for a RegExp engine, which doesn't support case modifiers, and XY is built with VB6. See http://www.xyplorer.com/xyfc/viewtopic.php?f=3&t=13507

Re: With regexp replace can you get the match and use it?

Posted: 08 Mar 2015 18:13
by mydarkpassenger
Surprised XYPlorer is still developed in VB6. It's such a limited language compared to most modern languages. I guess just too much work to move it to a new language.

Re: With regexp replace can you get the match and use it?

Posted: 08 Mar 2015 18:49
by bdeshi
Actually VB6's own features (or lack of them) plays little part in XYplorer's development. don makes extensive direct use of the underlying Windows API functions.