Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking string for predefined format
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00403485
Message ID:
00404949
Views:
15
>>>>>Sergey,
>>>>>
>>>>>Again, great for noticing. I understood this bug at home too, but your message was a reminder to me to fix it. I'll do it right now.
>>>>>
>>>>>Thanks again for your help. I noticed, you often use this technique, and I'll start too. I also will investigate "Ed's route"...
>>>>>
>>>>Out of general boredom:
>>>>
>>>>
oRegExp=CREATEOBJ('vbscript.regexp')
>>>>oRegExp.Pattern = '\d{6}[A-Z]-[A-Z]\d{6}[A-Z]-[A-Z]\d{6}[A-Z]{2}-[A-Z]{2}\d{6}[A-Z]'
>>>>? oRegExp.Test('012345A-B012345C-D012345EF-GH012345I')
>>>>? oRegExp.Test('012345A-b012345C-D012345EF-GH012345I')
>>>
>>>Great, Ed. Thanks a lot. One little problem: [A-Z] could be also space, e.g.
>>>in mask: lcMask = "999999X-X999999X-X999999XX-XX999999X"
>>>X could be upper alpha or space.
>>
>>Like this is difficult? Change [A-Z] to [A-Z ]
>>
>>This is definitely a case of RTFM; you neeed to read the docs to see what all the capabilities are.
>
>Yes, I'm reading :)
>
>lcAPN = "000000 - 001000 - 000000 - 000000"
>oRegExp=CREATEOBJ('vbscript.regexp')
>oRegExp.Pattern = '\d{6}[A-Z ]-[A-Z ]\d{6}[A-Z ]-[A-Z ]\d{6}[A-Z ]{2}-[A-Z ]{2}\d{6}[A-Z ]'
>? oRegExp.Test(lcApn) && .F. - should be .T.

Try again: (with proper formatting, sorry for mistake)
lcAPN  = "000000 - 001000 - 000000  -  000000"
oRegExp=CREATEOBJ('vbscript.regexp')
oRegExp.Pattern = '\d{6}[A-Z ]-[A-Z ]\d{6}[A-Z ]-[A-Z ]\d{6}[A-Z ]{2}-[A-Z ]{2}\d{6}[A-Z ]'
? oRegExp.Test(lcApn)
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform