Sometimes we forget

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Sometimes we forget

Post by kpassaur » Sat Aug 17, 2013 8:51 am

Sometimes we forget things like today when I was working on a date validation routine. I was using EasyPatterns and came up with this:

Let>text=1-20-1956

Let>pattern=[ Month Day pattern,text,1,matches,num,0
MessageModal>matches_1

Let>pattern=[ 2digits 2digitspattern,text,1,matches,num,0
MessageModal>matches_1


It should have failed but it didn't and it took me a while to get why - I am getting slower in my old age. But the reason is "matches_1" is from the first EasyPattern. To make it work either "matches" has to be changed or you need to confirm it with the number returned as shown below:



Let>text=1-20-1956

Let>pattern=[ Month Day pattern,text,1,matches,num,0
If>num=1
MessageModal>matches_1
Else
MDL>no match
Endif

Let>pattern=[ 2digits 2digitspattern,text,1,matches,num,0
If>num=1
MessageModal>matches_1
Else
MDL>no match
Endif

Hopefully if you are a beginner this will help you out.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts