SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Lytham
    Posts
    163
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript and regex problem

    I'm using the following in a function to find the destination url defined in a div:

    Code:
    src:    ((cls.match(/src:(\w+)/)||[])[1]),
    The code in the div looks like this:

    Code:
    ...class="page src:http://www.example.com"...
    However it is currently finding only the http:// part of the url and stopping, can anyone tell me how it should be written to get the whole url?

  2. #2
    SitePoint Member jingceawlin's Avatar
    Join Date
    Feb 2008
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try
    Code JavaScript:
     ((cls.match(/src:(\S+)/)||[])[1])

  3. #3
    SitePoint Zealot
    Join Date
    Nov 2004
    Location
    Lytham
    Posts
    163
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot, works fine


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
  •