23882[Clip] Re: alphanumeric character transcoding, by ones and pairs
- Jun 17, 2013--- In email@example.com, Ian NTnerd <indiamcq@...> wrote:
> Flo, I don't think you need to split first. Just extend your
> initial idea so that the replacement that has two characters
> has a | inserted between the characters. Then your first RE
> replace works fine.
Yes, I think you are right. I was misled by those 54 ^!Replace lines in message #23877. Only today, I see that there seems to be no difference between single characters and 2-character-sequences.
So why the heck does rickah make it three replacements: 'bJ' -> 'bS', 'b' -> 'b', and 'J' -> 'S' if the result is always the same? Also why 'KY' -> 'cF', 'K' -> 'c', and 'Y' -> 'F' etc...?
Unfortunately, the only one who could answer this has made himself scarce. So the job is much easier, indeed.
Obviously, we have to add 'D' -> 'f'.
Another idea is to store the search and replace characters in a LIST.TXT file as follows:
Among the search characters, the backslash is the only metacharacter that must be escaped: '\\'.
The clip will load and convert this list into an array %Char%:
^!If ^%i% > ^%Char0% Out
^!Replace "(?<!\|)^%Search%" >> "|^%RepWith%" WARS
^!Replace "|" >> "" WATS
Tested with NT Pro 7.1.
> I still think the before and after data strings are inconsistentYes, I agree with you. In the 54 ^!Replace commands, for example, 'A' is replaced with 'H' and not with 'h' as in the sample.
> with the supplied change values.
- << Previous post in topic Next post in topic >>