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

Free Support Forum - aspose.com

The match includes one or more special or break characters and cannot be replaced

I have this code,but there is an error

"NotSupportedException The
match includes one or more special or break characters and cannot be replaced."

<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

There is an error in regular expressions?

I want to get all characters do not include return

foreach (Aspose.Words.Paragraph
p in doc.Sections[0].Body.Paragraphs)<o:p></o:p>

{<o:p></o:p>

p.Range.Replace(@"(?s).*", “fa”);<o:p></o:p>

<o:p> </o:p>

}<o:p></o:p>

<o:p></o:p>

<o:p> I want to replace special characters(.) in the paragraph,for example:</o:p>

<o:p>The source:“This /is /word/ 1/1,a/a this is”</o:p>

<o:p>The target:“This /is /word/ 1.1,a/a this is”</o:p>

<o:p></o:p>


but use this code,no error

string pattern = @"(?s).";
string text = “The threaded application ate up the thread pool as it executed.\r”;
MatchCollection matches;

Regex defaultRegex = new Regex(pattern);
// Get matches of pattern in text
matches = defaultRegex.Matches(text); string pattern = @"(?s).";
string text = “The threaded application ate up the thread pool as it executed.\r”;
MatchCollection matches;

Regex defaultRegex = new Regex(pattern);
// Get matches of pattern in text
matches = defaultRegex.Matches(text);

Hi,

Thanks for your inquiry. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-8331 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi there,


On further investigation our development team came to know that they won’t be able to implement the fix to your issue. Your issue will be closed with ‘‘Won’t Fix’’ resolution.

The reason of the issue is that the following line of text contains the \r. Please modify the regex pattern to avoid such issue.

The reason of the issue is that following line of text contains the \r

Moreover, you can use the Document.Range.Replace to replace special character e.g ‘.’. Hope this helps you. If you still face problem, please manually create your input and expected output Word document using Microsoft Word and attach it here for our reference. We will investigate, how you want your final Word output be generated like. We will then provide you more information on this along with code.