Finding the second occurence

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Finding the second occurence

Postby TFerguson » Sun Sep 01, 2013 5:10 pm

How do I find the second occurrence of a character in the file name? In this case, I'm trying to replace the second occurrence of a 'space' with the character '~'.

TIA, TF
TFerguson
 
Posts: 1
Joined: Sun Sep 01, 2013 4:57 pm

Re: Finding the second occurence

Postby Stefan » Tue Sep 03, 2013 11:09 am

TFerguson wrote:How do I find the second occurrence of a character in the file name? In this case,
I'm trying to replace the second occurrence of a 'space' with the character '~'.

TIA, TF


Perhaps

Repl.(3)
Replace: ##
With: #~



?


Please wait a few seconds then submit. Thank you.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Replace 2nd occurence of Space

Postby truth » Sun Sep 08, 2013 3:49 am

Another solution using 1RegEx:
(.+? ])([^ ]*) (.*)
\1\2~\3

Group1 = everything until the 1st space
Group2 = everything except space (so that NextSpace must be the 2nd)
Group3 = everything after that 2nd space

If you'd rather not replace 2nd-space in SpaceSpace, change * in Group2 to +
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay


Return to BRU Support