regex replacement in variables (path)?

Started by lbo, September 01, 2019, 11:49:30 AM

Previous topic - Next topic

lbo

Hi all,

what would be a clean method to mangle a path name, for example in the batch processor, with a regular expression replacement?

The task is to strip characters following eight digits from a certain segment of the path name:

"x:\fff\20190830_foobar\x\y\z" -> "z:\ddd\20190830\x\y\z"
"x:\fff\20190829_othertext\a\b" -> "z:\ddd\20190829\a\b"

The resulting path name shall be used as output file name in the batch processor.

My existing PCRE replacement looks like this:

/^x:\\fff\\(\d{8})[^\\]*/z:\\ddd\\$1/

How is this done in IMatch?

Please let me know if you think it's cleaner to use IMatch scripting instead of the batch processor for this.

I think I read somewhere that you can also call image manipulation (resize, text overlays...) from IMWS

Mario

#1
The Batch Processor enables you to export your files in various formats, applying image operations.
It's not primarily for renaming files.

You have fine control over the output file name via folder patterns and variables. But no regexp replacements supported as far as I know. Did you read that in the Batch Processor help somewhere?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

lbo

Quote from: Mario on September 01, 2019, 01:06:50 PM
[...]no regexp replacements supported as far as I know.

Let me know if you remember it. regex replace in variables would be a powerful option. Using with the batch processor is only one example.

Quote from: Mario on September 01, 2019, 01:06:50 PM
Did you read that in the Batch Processor help somewhere?

Of course I researched thoroughly before posting. Not only the help page for the batch processor but also Variables, Regular Expressions, Folder Patterns and I searched the forum.

I didn't find any indication that regex based string replacement is possible with variables, therefore I asked here to be sure I didn't miss anything.

The "replace" function for variables allows part of what I do, but it doesn't seem to support wildcards or regex patterns.

Please note that this is no complaint, just a question what can be done.

For my current task, I likely will stay with my existing Perl based hack calling external image manipulation tools.