RegEx with Excel VBA on Mac

天大地大妈咪最大 提交于 2019-11-28 02:19:13

Natively, you can't really - AppleScript isn't actually that good for this kind of thing (where VBA is concerned)

There are other libraries that you can install and use to allow support for things like regular expressions on Mac OS - the one I've seen used the most is Satimage although I've not personally had to use it (yet) so can't vouch for it myself:

http://www.satimage.fr/software/en/downloads/downloads_companion_osaxen.html

You can use VBA's Like operator. It's a very limited regex tester only.

Microsoft Word has it's standard wildcards plus if you tick Use Wildcards it is a Regex engine (plus find words that sound the same, and words with the same root). So use Word rather than Vbscript's RegEx.

Just record a Find and Replace in Word and you'll get most of the program written for you that you'll just need to adapt.

I'm working on this problem too and I think Advanced Filters may be your answer if you want to do it in Excel without adding an external library. You can access it through VBA and set up a hidden sheet somewhere to stash your filters.

https://searchengineland.com/advanced-filters-excels-amazing-alternative-to-regex-143680

And you can see what it looks like in VBA here: https://www.contextures.com/exceladvancedfiltervba.html

However, Advanced Filters does have some notable shortcomings, like the inability to distinguish a digit from a letter. The LIKE command mentioned earlier DOES have this ability however - so you could combine them to overcome that limitation.

Hopefully you and I can both solve this problem using these tools...!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!