Insert chars in fname only if string matches

A swapping-ground for Regular Expression syntax

Insert chars in fname only if string matches

Postby Renamer34 » Fri Jan 08, 2016 8:49 pm

Filename is either
Stuff.1999.600d.other.txt
Or
Stuff.1999.other.txt.
If the former, I want the new filename to be:
Stuff (1999) [600d] other.txt

If the latter I want:
Stuff (1999) other.txt,
But instead I'm getting:
Stuff (1999) [] other.txt
Because the second numeric string is an empty match.

How can I optionally insert the brackets based on successfully matching the second numeric string?

Thanks.
Renamer34
 
Posts: 3
Joined: Fri Jan 08, 2016 8:21 pm

Re: Insert chars in fname only if string matches

Postby Stefan » Fri Jan 08, 2016 10:52 pm

Try to use additionally

Replace(3):
Replace: []#
With:


Instead the #-sign insert an space.



 
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU


Return to Regular Expressions