problem whit the syntax of a string

Good afternoon,

Someone can help me.I’ve this big problem.

In MyForm i have a MyField. This field is a stringedit with limittext == 11.

MyField.text must have this sintax ####-###-##(for example “0125-547-20”)

where # represents a number, not an alphabetic character,and in position 5 and 9 should be -.Also in the field can not be any spaces.

When one of these conditions is not met, an error message appears.

I tried to use strscan and strfind, but it is complicated.

someone any idea to solve this problem?
Thanks in advance

Tty this,

static void allowNumber(Args _args)
{
#define.numbers(‘0123456789-’)
str k = “1234-999-12”;
;
if((strkeep(substr(k,1,strlen(k)),#numbers) != substr(k, 1, strlen(k)))
|| strlen(k) != 11 || substr(k,5,1) != ‘-’ || substr(k,9,1) != ‘-’)
print “Wrong”;
else
print “Correct”;
pause;
}

How about RegEx?

str text = ‘0125-547-00’;

if(match(’<:d:d:d:d\-:d:d:d\-:d:d>’, text))
{
info(‘ok’);
}
else
{
info(‘fail’);
}

thank you very much it works perfectly