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 Regex to find a Match

Using Regex to find a Match

Scheduled Pinned Locked Moved C#
regexhtml
3 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.
  • B Offline
    B Offline
    butchzn
    wrote on last edited by
    #1

    Hi Guys, Please could someone assist me... I am trying to extract the text placed between i love puppies using regex. I have html in a variable and i am trying to establish whether an anchor tag exists in this string that contains "i love puppies" or if need be "love puppies". I have attempted to using this MatchCollection mAnchor = Regex.Matches(originalStr, @"(<a[^>]*> ('text'[^<]*) </a>)*", RegexOptions.IgnoreCase); but due to my lack of deeper understanding of regex...i have not been successful... Thank you in advance, Butch

    OriginalGriffO P 2 Replies Last reply
    0
    • B butchzn

      Hi Guys, Please could someone assist me... I am trying to extract the text placed between i love puppies using regex. I have html in a variable and i am trying to establish whether an anchor tag exists in this string that contains "i love puppies" or if need be "love puppies". I have attempted to using this MatchCollection mAnchor = Regex.Matches(originalStr, @"(<a[^>]*> ('text'[^<]*) </a>)*", RegexOptions.IgnoreCase); but due to my lack of deeper understanding of regex...i have not been successful... Thank you in advance, Butch

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Are "love puppies" a pseudonym? Never, mind I don't want to know... Try Expresso [^]- examines and generates Regular expressions. I use it all the time for regex creation. It also has a small library which may help.

      No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • B butchzn

        Hi Guys, Please could someone assist me... I am trying to extract the text placed between i love puppies using regex. I have html in a variable and i am trying to establish whether an anchor tag exists in this string that contains "i love puppies" or if need be "love puppies". I have attempted to using this MatchCollection mAnchor = Regex.Matches(originalStr, @"(<a[^>]*> ('text'[^<]*) </a>)*", RegexOptions.IgnoreCase); but due to my lack of deeper understanding of regex...i have not been successful... Thank you in advance, Butch

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        We would need to see examples of the text you are trying to parse.

        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