vbscript.regexp
Posted: Sun Oct 30, 2016 12:20 pm
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.
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))