Throwback Thursday: October 31, 2024

In today's edition of Throwback Thursday, we revisit my RegEx wrapper functions for VBA, while looking ahead to a future without VBScript.dll.

Throwback Thursday: October 31, 2024

With over a million words scattered across more than 1,300 articles on this blog, you've probably missed a few things here.

That’s why each week in "Throwback Thursday," we’ll revisit some standout posts. Expect a blend of my personal favorites, insightful articles from other great minds, and a touch of coding humor to keep things light.


"Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems." Jamie Zawinski's famous quote has taken on new meaning for VBA developers.

Years ago, I published three VBA functions that serve as wrappers around the VBScript regular expression library, making it easier to perform common regex tasks in VBA:

  • RegEx - performs a regular expression search on a string and returns the first match (or an empty string if no matches are found)
  • RegExReplace - replaces text in a string using pattern matching and backreferences
  • RegExExtract - extracts specific information from a string using pattern matching, returning an empty string if the pattern is not found

To help developers understand and test their regular expressions, I wrote about regex101.com, which provides real-time explanations of regex patterns and includes features like syntax highlighting, pattern testing, and a built-in cheat sheet.

In late 2023, Microsoft quietly announced the deprecation of VBScript, raising concerns about the future of regular expressions in VBA since they rely on the VBScript.dll library. After six months of uncertainty, Microsoft finally confirmed in May 2024 that vbscript.dll–and with it, VBA's native RegEx support–would indeed be removed from Windows, though they left open the possibility of providing an alternative solution in the future.

In response to these developments, Daniel Pineault demonstrated workarounds using the Script Control and Microsoft HTML Object Library, offering VBA developers practical solutions to maintain regex functionality in their applications.

While the confirmed loss of native RegEx support in VBA presents challenges, the community's resourcefulness in finding alternatives demonstrates that VBA developers will continue to solve problems–even if they now have three problems instead of two.

Highlights from NoLongerSet.com

Now you have two problems
Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems. --Jamie Zawinski
RegEx101.com
Writing and reading regular expressions is like speaking a foreign language. Think of regex101.com like Google Translate for regexes.
Microsoft Announces the Death of VBScript
As seems to be their new modus operandi, Microsoft has quietly rolled a hand grenade into the VBA development world with very little fanfare.
Microsoft Announces End of RegEx Support for VBA
We finally have an official timeline for when Microsoft will be dropping support for VBScript--and what impact that will have on VBA developers.

Wisdom from Around the Web

The End of RegEx in VBA, Not Quite So Fast!
Exploring what alternative we can use to perform RegEx operations in VBA since the VBScript libraries are being retired/removed in the not too distant future

Developer Humor

Regular Expressions

Wait, forgot to escape a space. Wheeeeee[taptaptap]eeeeee.

Acknowledgements
  • Article excerpt generated with the help of Claude-3.5-Sonnet-200k
  • Initial draft generated with the help of Claude-3.5-Sonnet-200k
  • Cover image generated by Ideogram

All original code samples by Mike Wolfe are licensed under CC BY 4.0