WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: kdmoyers on October 11, 2023, 04:51:47 AM

Title: vbscript is going away
Post by: kdmoyers on October 11, 2023, 04:51:47 AM
Here's a rather breathless article claiming that vbscript is going away, but the article is light on details.

https://www.theregister.com/2023/10/10/microsoft_says_vbscript_will_be/

I use
Code (winbatch) Select
objRE = ObjectOpen("VBScript.RegExp") frequently, do I need to worry that this will soon stop working?
Title: Re: vbscript is going away
Post by: td on October 11, 2023, 07:04:06 AM
MSFT always deprecates stuff but doesn't always follow through, so it is hard to know with any certainty. That said, .Net regular expressions classes are available via the WinBatch .Net hosting subsystem. The learning curve isn't too steep and there are examples on this forum.

Here is a link to an old article using .Net regular expressions. It needs to be updated to the current WinBatch .Net function usage but it gives you a good idea of what is involved:

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/dotNet/System_Text/RegularExpressions+RegEx.txt  (https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/dotNet/System_Text/RegularExpressions+RegEx.txt)

Title: Re: vbscript is going away
Post by: kdmoyers on October 11, 2023, 01:30:06 PM
got it, and got it working.  Took a while to get the options syntax correct:
Code (winbatch) Select
ObjectClrOption("useany","System")

oROpt = ObjectClrType("System.Text.RegularExpressions.RegexOptions", 1)

oReg = ObjectClrNew("System.Text.RegularExpressions.Regex",Pattern, oROpt)
oReg.CacheSize = ObjectType("ui2",30) ;2-byte unsigned integer.

Title: Re: vbscript is going away
Post by: stanl on October 12, 2023, 03:50:06 AM
You may find .net regex more robust than vbscript.
Title: Re: vbscript is going away
Post by: td on October 12, 2023, 06:56:20 AM
MSFT's official doublespeak on VBScript:

https://learn.microsoft.com/en-us/windows/whats-new/deprecated-features-resources (https://learn.microsoft.com/en-us/windows/whats-new/deprecated-features-resources)

It does not say anything about system COM Automation objects and their implementing DLLs, however.
Title: Re: vbscript is going away
Post by: stanl on October 14, 2023, 04:57:03 AM
Quote from: td on October 12, 2023, 06:56:20 AM
MSFT's official doublespeak on VBScript:

https://learn.microsoft.com/en-us/windows/whats-new/deprecated-features-resources (https://learn.microsoft.com/en-us/windows/whats-new/deprecated-features-resources)

It does not say anything about system COM Automation objects and their implementing DLLs, however.


There should be a Regex Pattern for 'doublespeak' ;D .  I doubt MicroSocks will take away performing regex with vbscript, but equally believe they will want developers...etc... to rely more on .NET/PS




'Call me: 123-456-7890 ASAP' -match '(?<areaCode>\d\d\d)-\d\d\d-\d\d\d\d'
$Matches.areaCode