Parsing txt file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • The.Relinator@gmail.com

    Parsing txt file

    Hello, I was wondering if anyone could show me the easiest way to parse
    an txt file for proxies, I was thinking of using regex, however I am
    unsure about how to carry out the actual "parsing".

    Any and all help would be greatly appreciated, thankyou

  • The.Relinator@gmail.com

    #2
    Re: Parsing txt file

    I forgot to mention the proxies would be in the ipaddress:port format

    The.Relina...@g mail.com wrote:
    Hello, I was wondering if anyone could show me the easiest way to parse
    an txt file for proxies, I was thinking of using regex, however I am
    unsure about how to carry out the actual "parsing".
    >
    Any and all help would be greatly appreciated, thankyou

    Comment

    • Miguel Cruz

      #3
      Re: Parsing txt file

      The.Relinator@g mail.com wrote:
      Hello, I was wondering if anyone could show me the easiest way to parse
      an txt file for proxies, I was thinking of using regex, however I am
      unsure about how to carry out the actual "parsing".
      How about if you show two or three lines of the file you are trying to
      parse, along with an explanation of what values you hope to get from it?

      miguel
      --
      Photos from 40 countries on 5 continents: http://travel.u.nu
      Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
      Airports of the world: http://airport.u.nu

      Comment

      • The.Relinator@gmail.com

        #4
        Re: Parsing txt file

        the file would be an html file such as the one below,and I hope to get
        the 23.324.4.034:34 4, 35.622.66.34:80 80 from it

        <html>
        <head>
        <titleTest </title>
        </head>
        <body>
        random text 23.324.4.034:34 4
        random text random text
        35.622.66.34:80 80 random text
        </body>
        </html>


        Miguel Cruz wrote:
        The.Relinator@g mail.com wrote:
        Hello, I was wondering if anyone could show me the easiest way to parse
        an txt file for proxies, I was thinking of using regex, however I am
        unsure about how to carry out the actual "parsing".
        >
        How about if you show two or three lines of the file you are trying to
        parse, along with an explanation of what values you hope to get from it?
        >
        miguel
        --
        Photos from 40 countries on 5 continents: http://travel.u.nu
        Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
        Airports of the world: http://airport.u.nu

        Comment

        • Rik

          #5
          Re: Parsing txt file

          The.Relinator@g mail.com wrote:
          the file would be an html file such as the one below,and I hope to get
          the 23.324.4.034:34 4, 35.622.66.34:80 80 from it
          >
          <html>
          <head>
          <titleTest </title>
          </head>
          <body>
          random text 23.324.4.034:34 4
          random text random text
          35.622.66.34:80 80 random text
          </body>
          </html>

          Somewhat crude, but I think thiw sill suffice:

          preg_match_all( '/[0-9]{1,3}(?:\.[0-9]{1,3}){3}:[0-9]+/',$html,$matche s);

          If you want to validate the IP adresses & portnumbers it's a whole other
          game.

          Grtz,
          --
          Rik Wasmus


          Comment

          • The.Relinator@gmail.com

            #6
            Re: Parsing txt file

            Thankyou Rik, you solved the problem, and no I do not need to validate
            anything, thankyou both for your help
            Rik wrote:
            The.Relinator@g mail.com wrote:
            the file would be an html file such as the one below,and I hope to get
            the 23.324.4.034:34 4, 35.622.66.34:80 80 from it

            <html>
            <head>
            <titleTest </title>
            </head>
            <body>
            random text 23.324.4.034:34 4
            random text random text
            35.622.66.34:80 80 random text
            </body>
            </html>
            >
            >
            Somewhat crude, but I think thiw sill suffice:
            >
            preg_match_all( '/[0-9]{1,3}(?:\.[0-9]{1,3}){3}:[0-9]+/',$html,$matche s);
            >
            If you want to validate the IP adresses & portnumbers it's a whole other
            game.
            >
            Grtz,
            --
            Rik Wasmus

            Comment

            Working...