Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts

    REGULAR EXPRESSION HELP... is this correct?

    I want to see if a condition matches the following..


    var countryMatch = /^['(149|14|163)']$/ ;

    is that the right way to test for THOSE THREE ITEMS : 149, 14, 163 ???

    ala..

    somecountry.match(countryMatch)

    Want to know if that reg ex up top is correct... those are numbers..

    please advise..

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,892
    Thanks
    202
    Thanked 2,528 Times in 2,506 Posts
    if (/^149|14|163$/g.test(countryMatch.value)) {

    returns true if the field contains 149 or 14 or 163 and nothing else.
    Last edited by Philip M; 08-01-2006 at 09:55 PM.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    349
    Thanks
    2
    Thanked 0 Times in 0 Posts
    thanks, totally appreciate it.


  •  

    Posting Permissions

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