Replacing bidirectional unicode strings/regexps

Ernst Elzas Ernste at
Sun Jan 15 10:32:54 EST 2006


I've tried to write a "sed s/original/replacement/g " -like script, but
for dealing with situations where both original and replacement contain
a mixture of left to right and right to left text (for now, English and
Hebrew) Both the texts can span multiple lines, and the replacement has
to be in files of a specific type (html) in all subdirectories. I'll
probably need to create the script (or at least the text to be replaced
and it's replacement) in some editor, since commandlines don't seem to
like bidirectional texts that much. I figured this would be easy, but
have not managed to get something working, nor have I found examples to
use. I did find some Python scripts doing related things, but they went
wrong as soon as I tried to adapt them to bidirectional text, the Perl
sed-like script also looked promising, but I did not manage to get that
working either in this situation. Please note that I had no prior
experience with the use of either language, and might easily have
overlooked the simple solution.

Thanks for your help,


More information about the Python-list mailing list