Page 1 of 1

Find/Replace Help. Neophyte OS X user

Posted: Mon Jun 26, 2006 10:52 pm
by bds
I am editing letters transcribed into TEI XML with Oxygen. Our grant project recently had to go through the process of renaming all of the image files for these letters, so now we have to change the <pg ref> tags to match.

Is there a way to use Find/Replace with a variable? What I'd like to do is this:
(origninal file name) rsl002a changed to (new file name) arm03020002001.

I can find, for example, "rsl" or "arm" but I need to find rsl003d and change it to something like arm03020003004. I'm slightly familiar with AppleScript, can I use this to accomplish this task if Find/Replace won't do it?

I apologize if this question makes people smack their foreheads is disbelief. We've got a lot of letters to edit, and if we can automate the process somewhat, it'll be a huge timesaver.

Thanks for your help,

Bridger

OS X 10.3.9, oxygen 7.2

Posted: Tue Jun 27, 2006 11:11 am
by sorin_ristache
Hello,

The Find/Replace support is able to reuse regular expression groups from a find match in the replace expression, for example if you match rsl003d with the find expression rsl(\d{3})(.+?)(\s*) and the replace expression is arm0302$1004$3 after replacement you get arm0302003004. You did not specify other connection between the match and the result of the replacement but if you need more than reuse of the groups, for example to replace a group of the match ($1, that is 003) with number($1) + 1 (that is 004) you should use an XSLT stylesheet to rename all the image files in your TEI XML documents.

Regards,
Sorin

Posted: Tue Jun 27, 2006 7:25 pm
by bds
Sorin,

Thank you for your help. I'm going to give the Find/Replace a try before I attempt to figure out the XLST.

Thanks again for your help.

Bridger