Range.Replace and case insensite searchs using regular expressions


#1

Hi!,
I'm trying to find some text using:

Range.Replace Method (Regex, ReplaceEvaluator, Boolean)

The regular looks like this: "(?i:Hello World)", it works using native .NET 2.0 classes as Regex and Match, but not using Aspose.Words, it only does a case sensite search.
What I'm doing wrong?

Thanks a lot
Guillermo


#2

Sorry, I made a mistake spelling some words, I mean case insensitive or case sensitive


#3

Have you tried specifying RegexOption.IgnoreCase explicitly during regular expression creation?


#4

Hi,
Thanks for your response.
Yes, I did but no success


#5

I have made a test document containing "Hello World" phrase in different case variations (e.g. "hello World", "hellO worLd", etc.) and tested replacement with the following code:

doc.Range.Replace(new Regex("(?i:Hello World)"), "Good-bye Everybody!");

This code successfully made case-insensitive search and replacement.

I have tested both in VS2003 and VS2005 projects.

I have also tested with Range.Replace(Regex, ReplaceEvaluator, Boolean) overload.

If you still have problems please provide a test project that will allow us to reproduce the error.

Best regards,