in reply to Orthography Translation using Regex

Well, the hard part is that it's not one char to one char. The simplest (and portable) way would be to just have a list of all the translations and do each one to the string. BUT, as others have pointed out, that might lead to problems if the output of one matches the input of another. So careful ordering of the individual replacements might fix that, and if there is a circular one somewhere then introduce a dummy code as an intermediate.

You can also try running the whole set at one position at a time, rather than running each translation over all positions. Without using fancy stuff like /G and setting the string's current scan postion, you can use a dummy char. For example, use * but in real life use something that is not a legal char. Start by prepending * to the string. Then your chain of replacements will be something like "*A/" to "Á*", that is, it moves the star to the next position when one is found. The last one moves it without changing the one character, and you stop when you find one that works and start over, repeating until the * is at the end.

I would suggest, regardless, that you use numeric codes instead of visible chars in the wrong character set in the source file.

  • Comment on Re: Orthography Translation using Regex