>>>Nadya --
>>>
>>>As Ed mentioned, if you can handle that with an input mask, that's the best approach -- catch errors before they occur -- and allow the user the opportunity to fix at data entry time.
>>>
>>>I assumed that you were processing data after the fact, hence the need for some algorithmic approach.
>>>
>>>I tried that approach because I've wondered how to do pattern matching with string functions in VFP. I have to admit, it's somewhat clumsy. But, it's interesting to see what you can do with the tools you have.
>>>
>>>VFP is not designed as a pattern matching language like SNOBOL, those its influenced like AWK, Perl, VBA, Python, etc. Using regular expressions, it's a simple matter to indicate a match between either of 2 characters: [X|9].
>>>
>>
>>There are any number of ActiveX or COM objects available with regular expressions; I use the VBScript.RegExp object from WSH, and JScript has regular expression parsing built in.
>
>The only reason I can think that Nadya wants to avoid using a language hosting regular expressions is for performance. Parsing one string is one thing. Parsing a gazillion, which she seems to do rather regularly, is another. I know we're speaking in generalities here, but what sort of overhead does calling VBS.RegEx from VFP have over using native VFP commands?
>
>
>Jay
In one file I can have 1000 - 100000 records. So, I want to process them as quickly, as possible. I believe, that the same problem was discussed before (may be year ago) and Sergey suggested chrtran approach then. I think, I tested VBScript.RegExp at the same time and found it to be much slower. Yesterday we discovered, that X could be either digit or letter, so my original approach needed to be corrected.
If it's not broken, fix it until it is.
My Blog