Page 1 of 1
Problem with RegEx Renaming scripts
Posted: 27 Aug 2008 06:51
by Mesh
I just started playing with scripts in XY, and I hit a bit of confusion.
I'm basically trying to code a script that runs several RegEx renames. However, what I'm finding is that rather than acting on all the selected files, it only acts on the files that the very first regex matches.
Even if I add code to reselect every file in the folder in between every single RegEx Rename, it still only acts on the files matched by the very first RegEx.
Is this a bug, or did I make a mistake?
Re: Problem with RegEx Renaming scripts
Posted: 27 Aug 2008 10:00
by jacky
hmm... no the rename command should apply to all selected items. Of course, only those with names matching your regexp will be renamed, but since selection remains the same after renaming, there's no reason other rename operation don't apply to all selected items.
I do have scripts that do multiple (regexp) rename operations in a row, and they are applied to all selected items without trouble.
Mesh wrote:Even if I add code to reselect every file in the folder in between every single RegEx Rename, it still only acts on the files matched by the very first RegEx.
So you select all files, do a regexp rename, and yet only files matching a previous regexp are affected !?? Sounds really odd indeed... Does that happen whatever the regexp used ? Could you share a little script with only two or three calls to rename that work that way ?
Re: Problem with RegEx Renaming scripts
Posted: 27 Aug 2008 15:44
by Mesh
I am happy for XY, but ashamed for myself, to say that this was a false alarm and the issue was caused by a coding error on my part.
In coding the script, I copied over RegEx's that I assembled in another text file which came from the manual renaming steps I had been using in XY. However, in the process of copying them over, a single line was missed which made all the difference.
My script syntax was fine, and the manual steps worked exactly as they should from top to bottom - so it appeared to be something else.
Please forgive me for bringing this up, and feel free to delete this thread.

Re: Problem with RegEx Renaming scripts
Posted: 27 Aug 2008 15:49
by admin
Mesh wrote:Please forgive me for bringing this up, and feel free to delete this thread.

I'll preserve it as a warning example.

Re: Problem with RegEx Renaming scripts
Posted: 27 Aug 2008 16:07
by Mesh
admin wrote:
Mesh wrote:
Please forgive me for bringing this up, and feel free to delete this thread.
I'll preserve it as a warning example.
Why do you hate me?
