Help!
So I have a converter from (non-Unicode) Sanskrit 1.2 font to (Devanagari Unicode) Sanskrit 2003 font.
http://is.gd/sw9ruq it works perfect in EmEditor. But Word does not support correct RegEx expressions, so I need and ask for help.
Code:
1) Works perfect:
"([क-ह]|[क़-य़])ρ","ρ\1"
"((([क-ह]|[क़-य़])्)+)ρ","ρ\1"
"i((([क-ह]|[क़-य़])्)+)","\1i"
2) Works perfect:
"i([क-ह]|[क़-य़])","\1ि"
"([१३])(([॒॑])+)","\1"
3) Does not work at all:
We look for "([॒॑])([ा-ौ]|[ॢॣ]|[ँंः])" and replace it with "\2\1"
"(([ा-ौ]|[ॢॣ]|[ँंः]|[॒॑])+)ρ","ρ\1"
After experimenting a while I've found Word 2007, 2010, 2013 does not support
. Same code works perfect in MS Excel, tested. And does not works in Word. I use C# for the converting purposes if that matters. The whole code for Word:
Code:
Word.Find find = app.Selection.Find;
string finds = listView1.Items[s].Text; // строка для поиска
find.Text = finds;
string fonts = txB_NAME_FONT.Text;
find.Font.Name = fonts; // поисковый шрифт
find.Replacement.ClearFormatting();
string Repl = listView1.Items[s].SubItems[1].Text; //строка для замены
Repl = Repl.Replace("\r", string.Empty);
find.Replacement.Text = Repl;
Object wrap = Word.WdFindWrap.wdFindContinue;
Object replace = Word.WdReplace.wdReplaceAll;
if ((s == 14) || (s == 199))
{
find.Text = "";
if ((finds.IndexOf("[") > 0)||(finds.IndexOf("]") > 0))
{
find.Text = "";
find.Text = finds;
}
else
{
find.Text = "";
find.Text = "[" + finds + "]"; //оборачиваем в скобки, иначе исключение для регулярок
}
find.Execute(FindText: Type.Missing,
MatchCase: false,
MatchWholeWord: false,
MatchWildcards: true, // включаем регулярки
MatchSoundsLike: missing,
MatchAllWordForms: false,
Forward: true,
Wrap: wrap,
Format: true,
ReplaceWith: missing, Replace: replace);
}
Thanks in advance to friends of India