Parameter checking

Sarah Reichelt sarahr at genesearch.com.au
Mon Jul 4 22:39:09 EDT 2005


> You can use RegEx to see if an incoming param matches a set of  
> strings or
> numbers. The basic rules are:
>
> 1) Put what you're looking for in brackets
> 2) If you actually have a range to check, you can use the hyphen  
> between
> (even for letters).
>
> So, for example, if you are checking to see if p1 is between A and  
> P (case
> insensitive), you can do this:
>
>   if not matchText(p1,"(?i)[A-P]") then exit to top
>
> OR this:
>
>   if not matchText(p1,"[A-Pa-p]") then exit to top
>
> the (?i) means to be case insensitive. Here's a few more from your  
> example:
>
>   if not matchText(p2,"[1-8]") then exit to top
>   if not matchText(p3,"[SD]") then exit to top  -- note s,d won't  
> match
>   if not matchText(p3,"(?i)[SD]") then exit to top  -- matches SDsd
>   if not matchText(p3,"[SDsd]") then exit to top  -- matches SDsd
>
> HTH,

You bet it does. Thanks Ken, you're a genius!

Sarah




More information about the use-livecode mailing list