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. I loathe regular expressions.

I loathe regular expressions.

Scheduled Pinned Locked Moved C#
regexhelpquestion
7 Posts 5 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

    Hi All! :-D I have posted a fe questions, read many tutorials, and doco's, have been on MSDN and Google, and have found absolutely zero support for the task I am trying to accomplish. I am simply trying to find every URL that is found in a plain text file, but it seems almost impossible to do since every sample I have tried, including my own code, does not work. It either brings up too many errors, or just never finds anything. Or both sometimes. Does anybody know of any reliable sources that could simply explain how one would go about finding all URL's inside a text file and saving those URL's to a new file each on a separate line, wether it is using Regex or something else? Any help would be appreciated. Thanks :) Regards, jay.

    jay

    B G L 3 Replies Last reply
    0
    • J jas0n23

      Hi All! :-D I have posted a fe questions, read many tutorials, and doco's, have been on MSDN and Google, and have found absolutely zero support for the task I am trying to accomplish. I am simply trying to find every URL that is found in a plain text file, but it seems almost impossible to do since every sample I have tried, including my own code, does not work. It either brings up too many errors, or just never finds anything. Or both sometimes. Does anybody know of any reliable sources that could simply explain how one would go about finding all URL's inside a text file and saving those URL's to a new file each on a separate line, wether it is using Regex or something else? Any help would be appreciated. Thanks :) Regards, jay.

      jay

      B Offline
      B Offline
      beatles1692
      wrote on last edited by
      #2

      Hi As far as I know you can use regular expressions to find different patterns in a text. I think you should find one or more suitable regex patterns for the task you want to accomplish. May be you should take a look at some regex libraries[^]

      J 1 Reply Last reply
      0
      • B beatles1692

        Hi As far as I know you can use regular expressions to find different patterns in a text. I think you should find one or more suitable regex patterns for the task you want to accomplish. May be you should take a look at some regex libraries[^]

        J Offline
        J Offline
        jas0n23
        wrote on last edited by
        #3

        thank you for the link :-) i will check it out now

        j.t.

        1 Reply Last reply
        0
        • J jas0n23

          Hi All! :-D I have posted a fe questions, read many tutorials, and doco's, have been on MSDN and Google, and have found absolutely zero support for the task I am trying to accomplish. I am simply trying to find every URL that is found in a plain text file, but it seems almost impossible to do since every sample I have tried, including my own code, does not work. It either brings up too many errors, or just never finds anything. Or both sometimes. Does anybody know of any reliable sources that could simply explain how one would go about finding all URL's inside a text file and saving those URL's to a new file each on a separate line, wether it is using Regex or something else? Any help would be appreciated. Thanks :) Regards, jay.

          jay

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

          Regular expressions are hard to write and very powerful once you get it to work. Start with some simple pattern so that you get a result, like finding every occurance of the string "http://" in the text. Then you can refine the pattern to find exactly what you want.

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

          1 Reply Last reply
          0
          • J jas0n23

            Hi All! :-D I have posted a fe questions, read many tutorials, and doco's, have been on MSDN and Google, and have found absolutely zero support for the task I am trying to accomplish. I am simply trying to find every URL that is found in a plain text file, but it seems almost impossible to do since every sample I have tried, including my own code, does not work. It either brings up too many errors, or just never finds anything. Or both sometimes. Does anybody know of any reliable sources that could simply explain how one would go about finding all URL's inside a text file and saving those URL's to a new file each on a separate line, wether it is using Regex or something else? Any help would be appreciated. Thanks :) Regards, jay.

            jay

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            You can also try using Expresso[^] and see if that helps at all.

            Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns

            P J 2 Replies Last reply
            0
            • L Lost User

              You can also try using Expresso[^] and see if that helps at all.

              Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns

              P Offline
              P Offline
              Paul Conrad
              wrote on last edited by
              #6

              Yep. I second that. Wonderful tool :)

              "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

              1 Reply Last reply
              0
              • L Lost User

                You can also try using Expresso[^] and see if that helps at all.

                Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns

                J Offline
                J Offline
                jas0n23
                wrote on last edited by
                #7

                Thanks everyone for your answers :-) i checked out the regex libs and quickly ran away from there lol... but then i checked out expresso, looks really cool it's still downloading, i can't wait to use it! thanks everyone :-D Here's an idea... If our brains consisted of computer chips, wouldn't it be cool if all we had to do to learn something new was to insert a tiny memory chip into our ears which stores all the learning material on it? Then if we needed to recall information, we can just use our minds to search thru directories and subdirectories to find the file in our mind that has our info? lol

                j.t.

                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