SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist runeveryday's Avatar
    Join Date
    Jul 2009
    Posts
    437
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    how to do the match in jquery?

    eg: there is a url as this:
    Code:
    http://example.com
    i want to make a match that the second part in the url are beginning of test. then do something.
    eg: if the url is IANA — Example domains or IANA — Example domains....

    thank you.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,717
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by runeveryday View Post
    eg: there is a url as this:
    Code:
    http://example.com
    i want to make a match that the second part in the url are beginning of test. then do something.
    eg: if the url is IANA — Example domains or IANA — Example domains....

    thank you.
    The standard location object contains that information, so location.pathname will be the path part of what you want.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

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