I get ASSERTION FAILED using VBSCRIP RegEx

Claudio Pratella 50 Reputation points
2025-09-08T15:28:56.48+00:00

I get this error using Web and app.User's image

Microsoft 365 and Office | Excel | For business | Windows
{count} votes

Answer accepted by question author
  1. Hendrix-C 8,570 Reputation points Microsoft External Staff Moderator
    2025-09-08T20:43:30.16+00:00

    Hi @Claudio Pratella

    Thank you for your prompt update. I've tried the pattern you provided and in my test device the result turns out that it still works properly in my Excel version.  

    However, according to your sharing, the issue happens after a recent update, and everything has worked normally until then. It's a right way to suspect whether it's a new issue with version updates but currently there has not been any official notifications about this issue from Microsoft. For now, we suggest you can try downgrade Excel to older version to see it still works well there and also prevent the negative effect of the issue to your workflow. You can follow these steps: 

    Step 1: Download and Extract ODT 

    Step 2: Create Your Custom Configuration File 

    • Open Notepad and paste the following XML: 

    <Configuration>  

    <Updates Enabled="TRUE" TargetVersion="16.0.xxxxx.yyyyy" />  

    </Configuration> 

    Step 3: Run the Installer 

    • Open Command prompt as administrator, navigate to the folder where setup.exe and your XML file are located, then run: 

    setup.exe /configure config.xml 

    • This will install the specified version of Office/Excel. 

    Step 4: Disable auto updates (Optional) 

    • Open Excel. 
    • Go to File > Account > Update options. 
    • Select Disable updates to prevent reverting to newer versions. 

    For more detailed guideline, you can refer to How to revert to an earlier version of Office - Microsoft Support

    Additionally, I strongly recommend submitting in-app feedback so that your experience can be formally logged with our engineering team. You can do this from Excel > Help > Feedback or go to Microsoft 365 Feedback Hub > send feedback. 
    User's image

    For now, I highly recommend accepting this answer as well. That way, other users who encounter the same question will see the clarification, and more of them may report similar problem, helping to bring attention to the request. The more reports the team receives, especially from business users, the faster issues like this can be prioritized and resolved as soon as possible. 

    I know this is not the experience you expected, and I want to thank you for your patience while the team works on improvements.  

    Thank you for your understanding and corporation. Please let me know if there's anything else I can help you with. 

    Looking forward to your response.


     If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread


6 additional answers

Sort by: Most helpful
  1. Viorel 125.7K Reputation points
    2025-09-08T19:10:10.1266667+00:00

    Try to replace

    Dim oRegEx As RegExp
    Set oRegEx = New RegExp
    

    with

    Dim oRegEx As New RegExp
    Set oRegEx = GetObject("", "VBScript.RegExp")
    

    and check if it works in various situations.

    1 person found this answer helpful.

  2. ron 5 Reputation points
    2025-09-09T13:09:39.0433333+00:00

    Since v2508, this problem can be reproduced with a simple regex and seems related to lookaheads, both positive and negative. And will occur with either early or late binding:

    Here is a simple example:

    'set reference to Microsoft VBScript Regular Expressions 5.5
    Option Explicit
    Sub due()
    Dim re As RegExp
        
    Const pat As String = ".*(?=abc)"
    Const target As String = "1234abcxy"
    
    Set re = New RegExp
    With re
        .IgnoreCase = True
        .Pattern = pat
        .Global = True
    End With
    
    re.Test (target)
    
    End Sub
    

    Microsoft should acknowledge this and give us a timeline for a fix. Especially since there do not seem to be any VBA alternatives.

    1 person found this answer helpful.

  3. PeterW 5 Reputation points
    2025-09-10T11:10:42.32+00:00

    A fix will be appreciated.

    1 person found this answer helpful.
    0 comments No comments

  4. Hendrix-C 8,570 Reputation points Microsoft External Staff Moderator
    2025-09-08T17:30:20.2833333+00:00

    Hello @Claudio Pratella

    Thank you for reaching out to Microsoft Q&A Community. 

    According to your concern, we've tested your provided script on the same version 2508 (Build 19127.20174). When debugging, the issue came from the syntax of this script .Pattern = "\b\b(the|an(?=-)|-|this|that|those|these)\b(?!?(?: and | or |[,.;'][*"\”|$))" 

    We suggest you can consider simplify the pattern, for example in our test we use Pattern = "\b(the|-|an|this|that|those|these)\b" and the script is running well without any error code. Also, you can go check the Tools > References > Look for Microsoft VBScript Regular Expressions 5.5 and toggle that to make sure the script will run properly.  

    User's image

    Please understand that our initial response does not always resolve the issue immediately. However, you can try workaround and share us more detailed information, we can work together to find a solution.      

    Thank you for your understanding and corporation. Looking forward to your response.


     If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread 

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.