Posted By

Scooter on 07/19/08


Tagged

regular expressions


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

benrudolph


isAlphaNumeric


 / Published in: ASP
 

URL: http://reusablecode.blogspot.com/2008/07/isalphanumeric.html

  1. <%
  2. ' Copyright (c) 2008, www.thecanonman.com; some rights reserved.
  3. '
  4. ' This work is licensed under the Creative Commons Attribution License. To view
  5. ' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or
  6. ' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California
  7. ' 94305, USA.
  8.  
  9. ' Checks if a string contains only alphanumeric characters.
  10. function isAlphaNumeric(someString)
  11. dim regEx
  12.  
  13. set regEx = new RegExp
  14.  
  15. with regEx
  16. .Global = true
  17. .IgnoreCase = true
  18. .Pattern = "[\w\s.]"
  19. end with
  20.  
  21. if regEx.test(someString) then
  22. isAlphaNumeric = true
  23. else
  24. isAlphaNumeric = false
  25. end if
  26.  
  27. set regEx = nothing
  28. end function
  29. %>

Report this snippet  

You need to login to post a comment.