+ Reply to Thread
Results 1 to 7 of 7

Regular Expressions

  1. #1
    Registered User
    Join Date
    04-28-2009
    Location
    Chicago, IL, USA
    MS-Off Ver
    Excel 2007
    Posts
    30

    Regular Expressions

    Having erroneously asked this in another thread, I am starting it anew in this one.

    The subject of Mid() came up, and after chasing it down, I understand how to use it and Left() to do some stuff.

    What I'm really after is a fully realized regular expression engine that can let me specify much less rigid structures. Perl, vi, various *nix shells all have them, but I can't find a good reference to them for Excel VBA. Rumor (in the form of shg) has it that what I seek is out there. So... any guidance?

    Thanks!

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Regular Expressions

    See http://msdn.microsoft.com/en-us/library/ms974570.aspx.

    When you use them in VBA with early binding, you need a reference to Microsoft VBScript Regular Expressions.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Regular Expressions

    Hi,

    Checkout the Morefunc add in. It may be what you're thinking of.

    Available from several places, one such being
    http://xcell05.free.fr/morefunc/english/

    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    04-28-2009
    Location
    Chicago, IL, USA
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Regular Expressions

    Okay, I'd be happy with either solution, but I started reading through the native VBA RegEx article shg mentioned. My question is... how do I use it? This is my ignorance of Excel showing through, but when I set a variable as a "regex" I'm told it's a user-defined type. Is there an additional library I need to load? I "grew up" in old-school Unix and I just don't know VBA/Windows well enough to know immediately how to do this.

    Thanks!

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Regular Expressions

    In the VBE, Tools > References, tick Microsoft VBScript Regular Expressions

  6. #6
    Registered User
    Join Date
    04-28-2009
    Location
    Chicago, IL, USA
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Regular Expressions

    I turned on Microsoft VBScript Regular Expressions but the script still returns that it's a user-defined type.

    And Richard, morefunc's download link fails. I found it here instead.

    I'll report back if i have any luck with it.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Regular Expressions

    You sure you turned it on? Tools > References, you see it among the checked items at the top?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1