[TxMt] Find, convert and replace image paths

James Mooney thelittleredhen at mac.com
Fri Oct 6 20:13:07 UTC 2006


 Alan,
Thank you so much for your speedy response. The images are in different places I'll try the second option as you suggest. I don't understand the specific meanings of (.*?) $1 and [^":]+):? with ?$1/? Is there a reference/source where I can learn more about searches and what those expressions mean?
Best regards,
James



On Friday, October 06, 2006, at 10:15AM, Allan Odgaard <throw-away-1 at macromates.com> wrote:

>On 6. Oct 2006, at 18:43, <thelittleredhen at mac.com> wrote:
>
>> I have an xml file that contains numerous image paths in this  
>> format <Pic_path href="HD2:Working Files:images:testpic.jpg"/>
>>
>> I need to convert them to this format <Pic_path href="file:/// 
>> Volumes/HD2/Working Files/images/testpic.jpg"/>
>>
>> Is there any way I can get TM to search for the paths and convert  
>> the text?
>
>If all the images are in the same location, you can enable Regular  
>Expressions, then search for: ?<Pic_path href="HD2:Working  
>Files:images:(.*?)"/>? and replace with: ?<Pic_path href="file:/// 
>Volumes/HD2/Working Files/images/$1"/>?.
>
>If however they vary in path, you will need to first do a replace  
>from: ?<Pic_path href="HD2:? to ?<Pic_path href="file:///Volumes/HD2/?.
>
>Then repeat a (regular expression) replace of: ?(<Pic_path  
>href="file:///Volumes/HD2/[^":]+):? with ?$1/? until no replacements  
>are done.
>
>Do a backup first!
>
>
>______________________________________________________________________
>For new threads USE THIS: textmate at lists.macromates.com
>(threading gets destroyed and the universe will collapse if you don't)
>http://lists.macromates.com/mailman/listinfo/textmate
>
>



More information about the textmate mailing list