Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-10-2013, 03:25 AM
gasyoun gasyoun is offline Convert RegEx to Word (Devanagari Font Find/Replace) Windows 7 32bit Convert RegEx to Word (Devanagari Font Find/Replace) Office 2007
Novice
Convert RegEx to Word (Devanagari Font Find/Replace)
 
Join Date: Apr 2013
Posts: 5
gasyoun is on a distinguished road
Thumbs down Convert RegEx to Word (Devanagari Font Find/Replace)

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
HTML Code:
(()())
. 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
Reply With Quote
 

Tags
convert, devanagari, regex



Similar Threads
Thread Thread Starter Forum Replies Last Post
wildcards in find & replace to reverse word order jeffk Word 3 11-11-2012 01:47 PM
MS Word Find and Replace not working allenglishboy Word 10 07-25-2012 08:05 AM
Convert RegEx to Word (Devanagari Font Find/Replace) Word Find and Replace Query bthart Word 1 12-29-2011 12:45 AM
Convert RegEx to Word (Devanagari Font Find/Replace) Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM
find&replace word in uppercase with word in lowercase andrei Word 3 10-03-2011 05:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft