When a format parameter contains a reference to an named capture, but this capture is not resolved, currently, there is a rule which prevents the remaining placeholder to be removed. Before applying this rule, we should be able to replace these unresolved captures as per user request. The user should be able to provide an else parameter, which is a compound string of the form:
"\,\;\,\;...\,\"
where named-capture-n is the name of the capture group and else-value-n is the else value that should be used for that capture if it is unresolved.
Eg:
for regular expression (git commit message check-in format, not a good example for renaming files/directories, but the point is still being made):
⚠️ Do not use comma as a separator, since it can be used in the file system and therefore would require some kind of escaping. The semi-colon to separate multiple fields is not ok either, so use a colon to separate a key from a value and | to separate fields:
When a format parameter contains a reference to an named capture, but this capture is not resolved, currently, there is a rule which prevents the remaining placeholder to be removed. Before applying this rule, we should be able to replace these unresolved captures as per user request. The user should be able to provide an else parameter, which is a compound string of the form:
"\,\;\,\;...\,\"
where named-capture-n is the name of the capture group and else-value-n is the else value that should be used for that capture if it is unresolved.
Eg:
for regular expression (git commit message check-in format, not a good example for renaming files/directories, but the point is still being made):
the named groups are:
so the user should be able to provide else specifiers for any of these groups
Rename-Many ... -Paste "COMMIT: ${type}, ISSUE: ${issue}" -Else 'type,none;issue,-'
⚠️ Do not use comma as a separator, since it can be used in the file system and therefore would require some kind of escaping. The semi-colon to separate multiple fields is not ok either, so use a colon to separate a key from a value and | to separate fields:
"\:\|\:\|...|\:\"