PDA

View Full Version : REG_REPLACE with Backreferences



Sensemann
Jan 12th, '05, 02:07 PM
Currently I'm working on an Export Template for the HD and want each quotation mark at the end of a word to be replaced by a " '' ". My idea is to use this REG_REPLACE:


<--REG_REPLACE--><--REGSTRING-->([a-z])"<--/REGSTRING--><--REPSTRING-->\1''<--/REPSTRING--><--/REG_REPLACE-->

But unfortunately it seems that the HD does not understand the backreference " /1 ".
In this post (http://www.herogames.com/forums/showpost.php?p=273692&postcount=35) Killer Shrike proposed a regex with this backreference functionality. Was backreference supported by an earlier version of the HD? Has anyone an alternative solution? I don't want to use 26 replace lines, one for each alphabetic character.

Thanks for helping!

Simon
Jan 12th, '05, 02:23 PM
1. I'm pretty sure that you don't want to do that....unless you've gone through all of your HTML code in the template and replaced the double quotes with single quotes....

2. try $1 for the first backreference.....IIRC, that's the format that Java looks for in its handling of regex.

Nothing has changed in HD's handling of regex.

Sensemann
Jan 12th, '05, 02:54 PM
Hi Simon,
thanks for your fast respons. Yes, I want to replace every double quotes with single quotes. I'm working on an export template for LaTeX, and with the german language pack a phrase like '... "Astral" und' would be changed to '... Ästral ünd' :nonp:.
But thanks for your help, it's working fine now.