Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. VERY STRANGE! what is this regex problem? [modified]

VERY STRANGE! what is this regex problem? [modified]

Scheduled Pinned Locked Moved C#
questionphpdatabasecomregex
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    enginco
    wrote on last edited by
    #1

    (@import\s|\S+-image:|background:)\s*?(url)*['"(]{1,2}(?!http)\s*/([^"')]+)['")]{1,2} it is working in these link's sources: http://www.hurriyetoto.com/oto/index.php[^ http://eniyion.hurriyet.com.tr/?sz=64757[^ but here it is not responding: http://www.sendeyolla.com/anasayfa.aspx?sz=64757[^ I tried with The Regex Coach, the result is same any ideas???

    I want to fly but I don't have wings

    modified on Wednesday, August 6, 2008 10:31 AM

    E 1 Reply Last reply
    0
    • E enginco

      (@import\s|\S+-image:|background:)\s*?(url)*['"(]{1,2}(?!http)\s*/([^"')]+)['")]{1,2} it is working in these link's sources: http://www.hurriyetoto.com/oto/index.php[^ http://eniyion.hurriyet.com.tr/?sz=64757[^ but here it is not responding: http://www.sendeyolla.com/anasayfa.aspx?sz=64757[^ I tried with The Regex Coach, the result is same any ideas???

      I want to fly but I don't have wings

      modified on Wednesday, August 6, 2008 10:31 AM

      E Offline
      E Offline
      enginco
      wrote on last edited by
      #2

      :wtf: ahaa, I found the problem. If the html source has a big VIEWSTATE, it doesn't respond. when I put spaces somewhere in the big viewstate regex was responded. Now I'm removing all viewstates's values :) It's working perfect :)

      I want to fly but I don't have wings

      modified on Wednesday, August 6, 2008 12:55 PM

      G 1 Reply Last reply
      0
      • E enginco

        :wtf: ahaa, I found the problem. If the html source has a big VIEWSTATE, it doesn't respond. when I put spaces somewhere in the big viewstate regex was responded. Now I'm removing all viewstates's values :) It's working perfect :)

        I want to fly but I don't have wings

        modified on Wednesday, August 6, 2008 12:55 PM

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        I see. I believe that it's the "\S+-image" part that is making it slow. The \S+ will match the entire viewstate value, but then it will not find "-image" at the end of it, so it will start going back through the viewstate character by character looking for "-image". Use som reasonable limit like \S{1,20} and it should be much faster.

        Despite everything, the person most likely to be fooling you next is yourself.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups