Eric Chatonet wrote:
Hi Graham,

I think that there should be also a solution using matchText :-)

Le 25 janv. 06 à 16:25, graham samuel a écrit :

What's the most economical way of checking that a string contains only certain characters? I'm just trying to check if a string contains letters, digits and underscores, and nothing else. The ways I've thought of doing it seem clunky. Basically I want to script

or try...

function isvalid mystring
  return not (matchtext(mystring,"[^a-zA-Z0-9_]+?"))
end isvalid

# there is a match if any character other than a-z A-Z 0-9 or _ is found
# in mystring
# using not inverts the result so that the function returns true
# if the string is valid.

Martin Baxter


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to