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.
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
Wisdom from Around the Web
Developer Humor
Regular Expressions
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