Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Regular expressions for a regular guy
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00807497
Message ID:
00807507
Views:
15
>I am writing a program to extract data from a memo field which matches a paterrn like this:
>
>999-999-999-999-99
>
>this pattern may occur 0 to n times in the field. There may not be any terminating characters separating other data from this pattern(s).
>
>I have tried
>oRegEx = CREATEOBJECT("VBScript.RegExp")
>oRegEx.Pattern = "\d{3}-\d{3}-\d{3}-\d{3}-\d{2}"
>oMatches = oregex.execute(memofld)
>? oMatches.count
>
>but count is never more than 1 !
>
>Sample Data:
>this should return 2
>071-027-100-005-00071-027-100-010-00PARCELS 1-A,2
>
>this should return 2
>071-027-100-005-00aaxx071-027-100-010-00PARCELS 1-A,2
>
>this should return 1
>071-027-100-010-00PARCELS 1-A,2
>
>this should return 1
>aaxx071-027-100-010-00PARCELS 1-A,2
>
>
>As you can see I am not too good with regular expressions and could use a little help.
>
>Thanks
>
>Glenn
>
>
>BROWSE FIELDS comment,cc=PADR(comment,80) FOR oregex.Test(comment)

Glenn,

It's this simple.
oRegEx.Global = .T.
By not setting this it only check for the first match.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform