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. Using Regular Expression

Using Regular Expression

Scheduled Pinned Locked Moved C#
regexhtmltestingbeta-testinghelp
8 Posts 3 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.
  • N Offline
    N Offline
    nasambur
    wrote on last edited by
    #1

    Hi, I m trying to extract all the images tags from the HTML page, i tried the below regex pattern, {1} this works fine when the HTML pagesource has tags in the single line.. This patterns fails when the image tag is splitted to two or more lines.. eg.. RTG, Software Testing Services plz help me. regards, nas

    A 1 Reply Last reply
    0
    • N nasambur

      Hi, I m trying to extract all the images tags from the HTML page, i tried the below regex pattern, {1} this works fine when the HTML pagesource has tags in the single line.. This patterns fails when the image tag is splitted to two or more lines.. eg.. RTG, Software Testing Services plz help me. regards, nas

      A Offline
      A Offline
      althamda
      wrote on last edited by
      #2

      Just put the entire HTML file into a string, remove the carriage returns then run your reg expr.

      N 1 Reply Last reply
      0
      • A althamda

        Just put the entire HTML file into a string, remove the carriage returns then run your reg expr.

        N Offline
        N Offline
        nasambur
        wrote on last edited by
        #3

        hi, thanx for reply.. i tried that too but unfortunately, i get only one match that too a huge line of all the code.. regards, nas

        A 2 Replies Last reply
        0
        • N nasambur

          hi, thanx for reply.. i tried that too but unfortunately, i get only one match that too a huge line of all the code.. regards, nas

          A Offline
          A Offline
          althamda
          wrote on last edited by
          #4

          Did you remove \n and \r?

          N 1 Reply Last reply
          0
          • A althamda

            Did you remove \n and \r?

            N Offline
            N Offline
            nasambur
            wrote on last edited by
            #5

            ya

            1 Reply Last reply
            0
            • N nasambur

              hi, thanx for reply.. i tried that too but unfortunately, i get only one match that too a huge line of all the code.. regards, nas

              A Offline
              A Offline
              althamda
              wrote on last edited by
              #6

              Try ]*>{1}

              J 1 Reply Last reply
              0
              • A althamda

                Try ]*>{1}

                J Offline
                J Offline
                joon vh
                wrote on last edited by
                #7

                that won't work because you can't have 's', 'r' or 'c' before the 'src' portion of your img. Sadly I don't have the answer (I'm trying to understand regex too)


                Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

                A 1 Reply Last reply
                0
                • J joon vh

                  that won't work because you can't have 's', 'r' or 'c' before the 'src' portion of your img. Sadly I don't have the answer (I'm trying to understand regex too)


                  Visual Studio can't evaluate this, can you? public object moo { __get { return moo; } __set { moo = value; } }

                  A Offline
                  A Offline
                  althamda
                  wrote on last edited by
                  #8

                  Very true, in that case - ]*src=[^>]*> That's even if he needs the src= bit in there, would probably work as ]*>

                  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