check for alphanumeric characters

Frank D. Engel, Jr. fde101 at fjrhome.net
Thu Mar 3 10:08:42 EST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hmm, I think I have a neat syntax to allow a future extension to 
Transcript; any takers?


if myVar contains any char not among the chars of 
"0123456789abcdefghijklmnopqrstuvwxyz'" then ...

And extend to other chunk types, of course:

if myVar contains any item among the lines of myOtherVar then ...



On Mar 3, 2005, at 7:21 AM, Mark Waddingham wrote:

> Hi Nicolas,
>
>> Is there a Rev function for checking whether a variable contains only
>> letters and/or numbers? When using clickChunk, I want anything not a 
>> word to
>> be ignored (e.g., punctuation).
>
> I think a Regular Expression is what you need. Try:
>
>   if matchText(tText, "^[0-9A-Za-z]+$") then
>     answer "It's alphanumeric :o)"
>   else
>     answer "It's not alphanumeric :o("
>   end if
>
> If you haven't come across Regular Expressions before, they are a good
> thing to have in your toolbox since they can help with many text-
> processing tasks.
>
> Revolution uses Perl-style expressions and as such there is a great 
> deal
> of literature on the internet about them, for example:
>
>     http://gnosis.cx/publish/programming/regular_expressions.html
>
> This is quite a nice walk-through of numerous example of them - 
> although
> being directed at Perl, you have to remember to read /[a-z]/ as 
> "[a-z]".
> ('/' is Perl's regular expression syntax, but in Revolution REs are 
> done
> via the matchText and related functions that just take an RE as a
> string)
>
> Warmest Regards,
>
> Mark.
>
> ------------------------------------------------------------------
>  Mark Waddingham ~ 36degrees at runrev.com ~ http://www.runrev.com
>        Runtime Revolution ~ User-Centric Development Tools
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
- -----------------------------------------------------------
Frank D. Engel, Jr.  <fde101 at fjrhome.net>

$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCJyh67aqtWrR9cZoRAsuAAJ9OnmmTZ7fRPM1QKrI5MovvCSr8SACeMwtL
67JfeTnlgxCw0XQLL+zb4Rs=
=8uTM
-----END PGP SIGNATURE-----



___________________________________________________________
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com



More information about the use-livecode mailing list