简体   繁体   中英

RegEx with Excel VBA on Mac

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?

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM