RegEx with Excel VBA on Mac

99封情书 提交于 2019-11-26 23:40:10

问题


I need to use regEx with Excel VBA. I'm using Mac OS 10.10 and Office 2011. So there is no DLL file I can use.

What is there to do here?

I read I've to bind an apple script. How is this done and what content does this script need?


回答1:


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




回答2:


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.




回答3:


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...!



来源:https://stackoverflow.com/questions/27344932/regex-with-excel-vba-on-mac

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