We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to replace text with pattern mode?

Hi to all,
I want to replace content in document with pattern match mode based on VB.net 2008 and aspose.words.dll version 14. How to do it?
for example:
Dim ReplaceCount as long=Doc.Range.Replace(“1234567890”,"", False, False)
this will work!
But, if doing that with pattern match replacement mode like this:
Dim ReplaceCount as long=Doc.Range.Replace("\d+","", False, False)
it doesn’t work. How to do it?

Thanks!

Ducaisoft

@ducaisoft

Thanks for your inquiry. Please use the following line of code to get the desired results.

Dim ReplaceCount As Long = doc.Range.Replace(New Regex("\d+"), "")

Hope, this helps.