Range.Replace does not throwing RegexMatchTimeoutException in .Net

Hi! I’m using Aspose.Words 21.3 for .Net and it’s seems like Method Range.Replace does not throwing RegexMatchTimeoutException. There is small example:

static void Main(string[] args)
    string pattern = @"<<MAIN(?'ItemProperties'[:](<<(?<LEVEL>)|>>(?<-LEVEL>)|(?!<<|>>).*?)+(?(LEVEL)(?!)))?>>.*?<<MAIN_END>>";
    Regex rgx = new Regex(pattern, RegexOptions.None, TimeSpan.FromSeconds(1));

    var doc = new Document();
        <<MAIN:CONDITION(Hardware)>> <<MAIN_CONTENT>>...Parent (root) Item Information...<<MAIN_CONTENT_END>><<MAIN_END>><<MAIN:CONDITION(Software)>><<MAIN_CONTENT>>...Child Item Information...<<MAIN_CONTENT_END>>
        <<LI:CONDITION(Operating System)>><<LI _CONTENT>>...Line Child Item Information...<<LI _CONTENT_END>><<LI _END>> <<NESTED_PRODUCTS_END>>

        FindReplaceOptions options = new FindReplaceOptions(FindReplaceDirection.Backward);
        options.UseLegacyOrder = true;
        options.MatchCase = false;
        doc.Range.Replace(rgx, String.Empty, options);
    catch (RegexMatchTimeoutException e)

@N.Kononovich Thank you for reporting this problem to us. I have managed to reproduce it. For a sake of correction the issue has been logged as WORDSNET-23428. We will keep you informed and let you know once it is resolved.

The issues you have found earlier (filed as WORDSNET-23428) have been fixed in this Aspose.Words for .NET 22.3 update also available on NuGet.

I am still able to reproduce the exact problem OP was suggesting. I have a couple of replace methods using the timeout functionality from Regex functions and it does not throw an exception as expected.

I have instances where the replace is taking close to 60 seconds and it completely ignores the timeout, which I set to 5 seconds, from my Regex (this is because the document is ~600 pages long

@perezh14 Could you please create a simple application that will allow us to reproduce the problem? I have tested with code that had been provided earlier in this thread and the problem is not reproducible using the latest 23.5 version of Aspose.Words.