Possibility to Insert characters with Rename Special

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Creat
Posts: 234
Joined: 22 Sep 2005 18:27

Possibility to Insert characters with Rename Special

Post by Creat »

Hello,

is it possible to insert some characters with any of the "Rename Special"-Tools at a specific place in the filename? I can match the position using RegEx, but I don't seem to be able to carry over the matched part (i.e. not replace it).

An example would be the filename "Something.or.other.###.something.else.ext" where ### are three digits.
I need to insert characters before and after the first of those digits, for example "Something.or.other.insert1#insert2##.something.else.ext", without (!!) removing or changing the digits.
The regular expression: "(\.)([0-9])([0-9][0-9])(\.)" should match & group the digits, but I can't find a way to just use the pattern to just find the spot and add characters (instead of replacing it with a static string).

Is there any way that I've missed?

thanks,
Creat

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Possibility to Insert characters with Rename Special

Post by jacky »

Creat wrote:The regular expression: "(\.)([0-9])([0-9][0-9])(\.)" should match & group the digits, but I can't find a way to just use the pattern to just find the spot and add characters (instead of replacing it with a static string).
Given what you describe, I would think that regexp is indeed the way to go. And the one you're using should be working, I just tried it as such and it looks to do what you want, here:

Code: Select all

\.([0-9]{1})([0-9]{2})\.>.FOO$1BAR$2.
(Note I only changed the syntax from [0-9][0-9] to [0-9]{2} only cause I like it better that way, but yours was working just as fine.)

To use matched part from your regexp they must be within parenthesis on your search pattern, then use the $n syntax on the replace pattern.

Hope this can help.

PS: A couple of examples & a link to a nice site about regexp and how they work can be found on XYwiki if you're interested ;)
Proud XYplorer Fanatic

Creat
Posts: 234
Joined: 22 Sep 2005 18:27

Re: Possibility to Insert characters with Rename Special

Post by Creat »

jacky wrote:Hope this can help.
Yea indead it did, thanks a bunch :)

this is awesome, finally just one click to rename everything! :D

bye
Creat

Post Reply