Page 1 of 1

vbscript.regexp

Posted: Sun Oct 30, 2016 12:20 pm
by Cliff Wiernik
I am looking at some simple regular expressions process where I will split out a normal US address line into its components. Number, Predirectional, street, type of street, post directional, apartment. I have some simple code using vbscript.regexp and while I can get the execute option to work, it creates a match and match collection as the output and I do not know yet how to work with that. I see Phil Ide's regexp item using PCRE.DLL but have not looked at that yet.

I am not interested in some of the services available at this time. That if for the future. I need to reasonably extract the street for some duplicate address checking we do.

The code in vb is as follows. I am trying to determine how to use the match collection and match items from vb in Xbase++. Plus with Xbase++ objects you can inspect them to look at the instances variables and methods. How do you do this with an activeX/com object.

Code: Select all

        Set mc = re.Execute(strInput)                                              // executes the vbscript.regexp execute  method
                                                                                              // mc appears to be a match collection returned by the exceute
        Set ma = mc(0)                                                                 // ma is a match  
         
        uxHouseNumber = Trim$(ma.SubMatches(0))
        uxStreetPrefix = Trim$(ma.SubMatches(1))
        uxStreetName = Trim$(ma.SubMatches(2))
        uxStreetType = Trim$(ma.SubMatches(3))
        uxStreetSuffix = Trim$(ma.SubMatches(4))
        uxApt = Trim$(ma.SubMatches(5))


Re: vbscript.regexp

Posted: Sun Oct 30, 2016 3:35 pm
by rdonnay
Plus with Xbase++ objects you can inspect them to look at the instances variables and methods. How do you do this with an activeX/com object.
For years, I have asked Alaska Software to give us a ClassDescribe() for automation objects but they have given it no priority.

I had to write a kludgy workaround for CodeJock in which I built a bunch of .DEF files (located in \exp20\classdef).

DC_InspectObject() will look for a .DEF file when inspecting an automation (ActiveX) object.

I created some utilities that scans a .PRG file created by JazzAge Wizard to do this.
It was a real pain in the ass.

I need some pressure from our community to Alaska to get some help from them on this.
It is way overdue.

Re: vbscript.regexp

Posted: Sun Oct 30, 2016 8:55 pm
by Cliff Wiernik
I also looked at the jazzage info. I will ask some questions of Alaska support also. But as you indicated, if you don't know what is coming back, it is hard to work with.