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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2009
    Posts
    152
    Thanks
    8
    Thanked 0 Times in 0 Posts

    how to do the match in jquery?

    eg: there is a url as this: http://example.com

    i want to make a match that the second part in the url are beginning of test. eg:
    Code:
    http://example.com/test/...

    thank you.

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 Posts
    A match? What does this have to do with jQuery? I think this is pure javascript with regular expressions
    Code:
    var myRegex = new RegExp("http:\/\/example\.com\/test", "i");
    if(yourURL.match(myRegex)) {
       ...
    }


  •  

    Posting Permissions

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