find and replace links in a large text file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • d-null
    . . .
    • Apr 2007
    • 13724

    #1

    find and replace links in a large text file

    is there a utility, or is it possible with notepad++ or any other of the popular code editors to do a search and replace with wildcards?


    eg. say you have a large text file, that is scattered with a bunch of <a href... type of links, but they are all different as far as text and url's, I would like to use a * wildcard to be able to search for all occurences of any type of link and replace it with something else


    any ideas?

    __________________

    Looking for a custom TUBE SCRIPT that supports massive traffic, load balancing, billing support, and h264 encoding? Hit up Konrad!
    Looking for designs for your websites or custom tubesite design? Hit up Zuzana Designs
    Check out the #1 WordPress SEO Plugin: CyberSEO Suite
  • woj
    <&(©¿©)&>
    • Jul 2002
    • 47880

    #2
    regexp FTW
    Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
    Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
    Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

    Comment

    • d-null
      . . .
      • Apr 2007
      • 13724

      #3
      Originally posted by woj
      regexp FTW
      ok, I'm seeing it, now just have to learn the syntax :P

      __________________

      Looking for a custom TUBE SCRIPT that supports massive traffic, load balancing, billing support, and h264 encoding? Hit up Konrad!
      Looking for designs for your websites or custom tubesite design? Hit up Zuzana Designs
      Check out the #1 WordPress SEO Plugin: CyberSEO Suite

      Comment

      • fris
        I have to go potty
        • Aug 2002
        • 55751

        #4
        Code:
        sed 's/old/new/g' input.txt > output.txt
        Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


        Totally Free Templates

        Comment

        • d-null
          . . .
          • Apr 2007
          • 13724

          #5
          Originally posted by fris
          Code:
          sed 's/old/new/g' input.txt > output.txt
          interesting, I need it to do some regexp matching though, the old url's are all different, and I want to match them all with one command

          __________________

          Looking for a custom TUBE SCRIPT that supports massive traffic, load balancing, billing support, and h264 encoding? Hit up Konrad!
          Looking for designs for your websites or custom tubesite design? Hit up Zuzana Designs
          Check out the #1 WordPress SEO Plugin: CyberSEO Suite

          Comment

          • GrouchyAdmin
            Now choke yourself!
            • Apr 2006
            • 12085

            #6
            wildcard to match any type of link? Sure!

            Code:
            /a[\s]+[^>]*?href[\s]?=[\s\"\']+(.*?)[\"\']+.*?>([^<]+|.*?)?<\/a>/i
            Enjoy.

            Comment

            • d-null
              . . .
              • Apr 2007
              • 13724

              #7
              Originally posted by GrouchyAdmin
              wildcard to match any type of link? Sure!

              Code:
              /a[\s]+[^>]*?href[\s]?=[\s\"\']+(.*?)[\"\']+.*?>([^<]+|.*?)?<\/a>/i
              Enjoy.
              thanks Grouchy, you saved me some time, I'll try it out soon

              __________________

              Looking for a custom TUBE SCRIPT that supports massive traffic, load balancing, billing support, and h264 encoding? Hit up Konrad!
              Looking for designs for your websites or custom tubesite design? Hit up Zuzana Designs
              Check out the #1 WordPress SEO Plugin: CyberSEO Suite

              Comment

              • d-null
                . . .
                • Apr 2007
                • 13724

                #8
                edit: not working for some reason, is the code right and I am doing something wrong? using regexp search but not matching

                __________________

                Looking for a custom TUBE SCRIPT that supports massive traffic, load balancing, billing support, and h264 encoding? Hit up Konrad!
                Looking for designs for your websites or custom tubesite design? Hit up Zuzana Designs
                Check out the #1 WordPress SEO Plugin: CyberSEO Suite

                Comment

                • 96ukssob
                  So Fucking Banananananas
                  • Mar 2003
                  • 12991

                  #9
                  download textpad, it works great.

                  press F8, then use .*. as the wild card.
                  Email: Clicky on Me

                  Comment

                  • GrouchyAdmin
                    Now choke yourself!
                    • Apr 2006
                    • 12085

                    #10
                    The above is Perl Regex, not "universal" regex.

                    Comment

                    • d-null
                      . . .
                      • Apr 2007
                      • 13724

                      #11
                      Originally posted by GrouchyAdmin
                      The above is Perl Regex, not "universal" regex.
                      oh ok, I was trying to use it with notepad++ and no luck with that

                      __________________

                      Looking for a custom TUBE SCRIPT that supports massive traffic, load balancing, billing support, and h264 encoding? Hit up Konrad!
                      Looking for designs for your websites or custom tubesite design? Hit up Zuzana Designs
                      Check out the #1 WordPress SEO Plugin: CyberSEO Suite

                      Comment

                      • GrouchyAdmin
                        Now choke yourself!
                        • Apr 2006
                        • 12085

                        #12
                        Originally posted by d-null
                        oh ok, I was trying to use it with notepad++ and no luck with that
                        I just use TextPad for that kind of shit when on Windows It usually takes normal, or semi-perl regex just fine. Sorry, never used NP++.

                        Comment

                        • d-null
                          . . .
                          • Apr 2007
                          • 13724

                          #13
                          found the answer:


                          Code:
                          <a href="[^"]+">[^<]+</a>

                          thanks for the help, it was interesting, maybe this thread will help someone else too

                          __________________

                          Looking for a custom TUBE SCRIPT that supports massive traffic, load balancing, billing support, and h264 encoding? Hit up Konrad!
                          Looking for designs for your websites or custom tubesite design? Hit up Zuzana Designs
                          Check out the #1 WordPress SEO Plugin: CyberSEO Suite

                          Comment

                          Working...