Avatar of Alex E.
Alex E.

asked on 

backslash character VBScript runtime error: Syntax error in regular expression

Hello I´m using a a VBscript to search 2 strings in the middle of one.

Set oRE = CreateObject("vbscript.regexp")
oRE.Global = True
oRE.Pattern = "\activ\(.*?)\vid"

Open in new window


In this test the script need to search for strings "\activ\" and "\vid"

Now I received the error when I run the VBscript via command prompt with cscript: "VBScript runtime error: Syntax error in regular expression"

Now I see the backslash "\" characters are not accepted to search in the string. I tested the script with letters and numbers including normal "/" and works but how can I modify the script to accept in the search string and search also "\" backslash characters?

Thank you
Regular ExpressionsVB Script

Avatar of undefined
Last Comment
Alex E.

8/22/2022 - Mon