Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to replace a text in word document using wildcards in c# .net. I have following code:


SQL
wordApp.Selection.Find.ClearFormatting();
_wordApp.Selection.Find.MatchWildcards = true;
_wordApp.Selection.Find.Text = "<[0-9]{9}>";



The above code for find works but for replace i tried:


SQL
wordApp.Selection.Find.Replacement.ClearFormatting();
_wordApp.Selection.Find.Replacement.Text = "test";



its not getting replaced.
Please provide me some solution.


Thanks
Posted
Comments
[no name] 4-Jul-14 4:09am    
http://msdn.microsoft.com/en-us/library/f65x8z3d(v=vs.90).aspx
Member 10391350 4-Jul-14 4:43am    
I am using wildcards as true,so normal text replace will work but I want to replace a regex pattern for eg:

wordApp.Selection.Find.Replacement.Text ="^p";
I want the text to be replaced based on the pattern.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900