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. Regular Expressions

Regular Expressions

Scheduled Pinned Locked Moved C#
regextutorialquestionhtmlcom
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.
  • J Offline
    J Offline
    jas0n23
    wrote on last edited by
    #1

    Hello everybody! :-) I am working on a little program and I was wondering if somebody could kindly offer me some help on using Regex? Here's a scenario, let's say that I have a HTML file... I want to be able to find any text inside a HTML tag. For example: Find meeee! or; la la lalaaaa But, the text between the HTML tags may contain symbols, letters, numbers etc, so is there a simple way to use Regex to find any text inside a HTML tag, extract/copy it, and perform an action, and then move onto the next match?: 1. Find match. 2. Copy or Extract the match. 3. Perform an action, like save match to file (which I know how to do). 4. Find next match, and repeat process. I would greatly appreciate any help I can get on this. Lots of thanks in advance and thanks for taking the time to read this pretty long question. :-) P.S. I wouldn't have posted this message, but I have tried MSDN and Google, read articles and tutorials but just can't get any of the snips I wrote to work. Cheers, Jay. foreach( inch on Jason ) { Girlfriend.IsHappier(); }

    M Y 2 Replies Last reply
    0
    • J jas0n23

      Hello everybody! :-) I am working on a little program and I was wondering if somebody could kindly offer me some help on using Regex? Here's a scenario, let's say that I have a HTML file... I want to be able to find any text inside a HTML tag. For example: Find meeee! or; la la lalaaaa But, the text between the HTML tags may contain symbols, letters, numbers etc, so is there a simple way to use Regex to find any text inside a HTML tag, extract/copy it, and perform an action, and then move onto the next match?: 1. Find match. 2. Copy or Extract the match. 3. Perform an action, like save match to file (which I know how to do). 4. Find next match, and repeat process. I would greatly appreciate any help I can get on this. Lots of thanks in advance and thanks for taking the time to read this pretty long question. :-) P.S. I wouldn't have posted this message, but I have tried MSDN and Google, read articles and tutorials but just can't get any of the snips I wrote to work. Cheers, Jay. foreach( inch on Jason ) { Girlfriend.IsHappier(); }

      M Offline
      M Offline
      musefan
      wrote on last edited by
      #2

      well i am assuming you know how to use the regex class and loop matches so ill attempt at a regex string for you... "^<.*>.*<.*>$" then with you match you could do a subtring...

      string text = match.Substring(match.IndexOf('>') + 1, match.LastIndexOf('<'));

      ...maybe that will do it for you

      Life goes very fast. Tomorrow, today is already yesterday.

      1 Reply Last reply
      0
      • J jas0n23

        Hello everybody! :-) I am working on a little program and I was wondering if somebody could kindly offer me some help on using Regex? Here's a scenario, let's say that I have a HTML file... I want to be able to find any text inside a HTML tag. For example: Find meeee! or; la la lalaaaa But, the text between the HTML tags may contain symbols, letters, numbers etc, so is there a simple way to use Regex to find any text inside a HTML tag, extract/copy it, and perform an action, and then move onto the next match?: 1. Find match. 2. Copy or Extract the match. 3. Perform an action, like save match to file (which I know how to do). 4. Find next match, and repeat process. I would greatly appreciate any help I can get on this. Lots of thanks in advance and thanks for taking the time to read this pretty long question. :-) P.S. I wouldn't have posted this message, but I have tried MSDN and Google, read articles and tutorials but just can't get any of the snips I wrote to work. Cheers, Jay. foreach( inch on Jason ) { Girlfriend.IsHappier(); }

        Y Offline
        Y Offline
        Yusuf
        wrote on last edited by
        #3

        All RegEx help you want -> http://www.regular-expressions.info/[^]

        Yusuf Can I help you?

        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