Regular Expression to Parse url('link')

Discussion in 'Programming' started by ivenms, May 1, 2008.

  1. #1
    Looking for regular expression to satisfy the condition "url\('(.*)'\)" for the string.

    Any idea to parse url() from a string?

    Thanks in advance.


    Aim:

    To parse every css urls from an HTML string.
     
    ivenms, May 1, 2008 IP
  2. xrvel

    xrvel Notable Member

    Messages:
    918
    Likes Received:
    30
    Best Answers:
    2
    Trophy Points:
    225
    #2
    Maybe this works (untested)

    url\((\"|\')?(.*)?(\"|\')?\)
    Code (markup):
     
    xrvel, May 2, 2008 IP
  3. ivenms

    ivenms Peon

    Messages:
    334
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the response. But the regex not working.

    Also parsing with regular expression takes too much load on my server. Is there any effective way to parse every desired elements from HTML plage? (Not as DOM elements. I need css properties also)
     
    ivenms, May 2, 2008 IP
  4. dev102

    dev102 Peon

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What language are you using?
     
    dev102, May 4, 2008 IP
  5. ivenms

    ivenms Peon

    Messages:
    334
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    PHP..

    Don't bother about this ...

    Now I managed to parse every thing without using Regular Expressions. Regular Expression parsing takes too much load and time. So i switched to normal search method to find unique texts on string.
     
    ivenms, May 4, 2008 IP