Results 1 to 3 of 3

Thread: like [a-z]

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2001
    Location
    Lebanon,Beirut
    Posts
    48

    Lightbulb like [a-z]

    hi there,i need to write a function that alert me if the textfield value is not between [a-z] and [1-9] and other charchters like underscor "_",
    i know there is a "LIKE" function in Vb,but when it comes to Jscript,i'm just a beginner,thank you for your time.

  2. #2
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Well, I don't do anything with JScript, so I wouldn't know...

    But in JavaScript...

    Code:
    if (testString.search(/\W/) != -1) {
      // String is good, contains only a-zA-Z0-9_
    }
    else {
      // String is bad, warn user
    }
    Ofcourse, TIAMTOW, and I haven't even tested this code.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  3. #3
    PowerPoster rjlohan's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    3,205
    I found a sweet script to do this somewhere. I think she's on my home machine though, so I'll send it later if I remember.
    Someone post here to remind me, and I'll see the reminder when I check my email at home later...

    -----------------------------------------
    -RJ
    [email protected]
    -----------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width