3:Replace, First Instance Only

Would you like Bulk Rename Utility to offer new functionality? Post your comments here!

3:Replace, First Instance Only

Postby therube » Mon May 18, 2020 2:06 pm

3:Replace, would be enhanced, if there were a 'First Instance Only' checkbox.
(Or better ? a user definable number?)

That would make it easier in situations where the current global scope of 3:Replace is too broad (which would then most likely require RegEx to accomplish the need).
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: 3:Replace, First Instance Only

Postby roozo » Thu Jun 18, 2020 7:41 am

There doesn't seem to be a good answer to this, the checkbox would be great, I need to know How do I remove the first instance of a word ie, the word 'The', as in The Killers, The Rolling Stones etc, but no other, as in Blowing in the Wind I used Match Case but many names capitalise all words
roozo
 
Posts: 1
Joined: Thu Jun 18, 2020 6:32 am

Re: 3:Replace, First Instance Only

Postby RegexNinja » Fri Jun 19, 2020 1:53 am

Roozo, to remove 'The ' as beginning-text, use Regex Match/Replace:
^The (.*)
\1
RegexNinja
 
Posts: 134
Joined: Fri Feb 21, 2020 5:26 pm

Re: 3:Replace, First Instance Only

Postby Admin » Tue Sep 22, 2020 1:21 am

This has been added to version 3.4.1.0

Replace (3)

Replacement. It allows you to replace occurrences of one text string with another.

This section consists of two controls. You must specify the text you wish to Replace and the text you wish to replace it With. It is possible to find a text string and replace it with an empty string, or with a shorter string, or with a longer string. You may also specify whether or not you want the "find" to be case-sensitive using Match Case. Note that the text is always replaced with the text you specify, including any specific text case.

Multiple replacements can be specified using the | separator. For example, Replace:1|2 With:3|4 will replace 1 with 3 and 2 with 4. Replace:1|2 With:3 will replace 1 with 3 and 2 also with 3. If you need to use | as a character itself for renaming, then escape it with a \. For example, Replace:1\|2 With:3 will replace 1|2 with 3, the character | will not be used as separator.


· Match Case - Perform case-sensitive replacement.

· First - Replace only first match.


To replace only the First, Last, Start, End, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth match, use the position \modifier\ , for example:

Replace: \first\a - With: b - This will replace only the first a in the name with b.

The position modifier has to be specified between two \ at the start of the replace string. The following positions are supported:

\first\ , \last\ , \start\ , \end\ : replaces only first match, last match, at start of name, at end of name.

\second\ , \third\ , \fourth\ , \fifth\ , \sixth\ , \seventh\ , \eighth\ , \ninth\ : replaces only nth match.

Example: Replace: \last\text - With: - This will replace only the last 'text' with an empty string, i.e. it will be removed.
Example: Replace: \start\text - With: txt - This will replace 'text' with 'txt' only at start of name.
Example: Replace: \second\text - With: txt - This will replace only the second match of 'text' with 'txt'.


Note: It is also possible to use the tag <clip> in both the Replace and With fields. <clip> will be substituted with the current text content of the Windows Clipboard.
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: 3:Replace, First Instance Only

Postby Luuk » Tue Sep 22, 2020 9:45 am

Thanks for update!! Please also to be careful with positions \modifier\ not to blend with "|" because it invents a surprising consequences.
Luuk
 
Posts: 690
Joined: Fri Feb 21, 2020 10:58 pm

Re: 3:Replace, First Instance Only

Postby Admin » Wed Sep 23, 2020 1:53 am

Which consequences? :)
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: 3:Replace, First Instance Only

Postby Luuk » Wed Sep 23, 2020 5:21 am

Greetings. The "|" is prejudice against \modifier\ and makes it go away, so "\second\u|x" instead conducts like "u|x".
Luuk
 
Posts: 690
Joined: Fri Feb 21, 2020 10:58 pm


Return to Suggestions