hi Agnes,
One small correction
loRegExp.PATTERN = '^PM\d\d$'
>Hi Matthew,
>
>it will not work with a signle VFP command. You have only like() and this works DOS like with *? wildcards
>
>You may do something like
>
>if !(worktype='PM' and isdigit(substr(worktype,3,1)) and isdigit(substr(worktype,4,1))) then
>endif
>
>
>there is a more clever solution with regexp.
>
>loRegExp = CREATEOBJECT('VBScript.RegExp')
>loRegExp.PATTERN = '^PM\d\d'
>
>if !loRegExp.TEST(workplace) then
>...
>endif
>
>
>Agnes
>>Hi there,
>>
>>I'm having problems figuring out wildcards for string comparisons.
>>
>>I have a WorkType variable that is a string. It always starts with PM and then a 2 digit number. So I want to have an if statement checking it's valid. i've used this code and it doesn't work:
>>
>>If WorkType != "PM##"
>> lcErrorMessage = lcErrorMessage + "Work type is invalid..."
>>Endif
>>
>>So when valid WorkType come in (e.g. PM03, PM14) they are failing.
>>
>>Any help would be much appreciated
Gregory