Tapatalk

function that allow to erase all comment and page break?

function that allow to erase all comment and page break?

cporeaux

    Jun 13, 2005#1

    Hi
    I am use Ultraedit a short time

    I ask me : is there a function that allow to
    erase all comment and page break?

    6,685587
    Grand MasterGrand Master
    6,685587

      Jun 14, 2005#2

      A macro with regular expression search and replaces can do that. See help of UE about regular expression search and replace before asking again.

      You don't have written for which language: 'C', HTML, PHP, ASM, ... !!!
      Best regards from an UC/UE/UES for Windows user from Austria

      cporeaux
      cporeaux

        Jun 15, 2005#3

        The language is Html

        I have read the guide
        I ask me : is there a function that allow to erase all comment and page break?
        To erase Page break I must type ^b

        To erase the comment, that is <!-- --> , how must I do?
        I have try already writing
        ^(<!--*-->^) ^b
        but the result is null.

        5
        NewbieNewbie
        5

          Jun 15, 2005#4

          The following works for me:

          In replace dialog, check "regular expressions".

          Find: <!--*-->
          Replace (nothing)

          cporeaux
          cporeaux

            Jun 15, 2005#5

            For me doesn't works :(

            I mean all the strings
            that start with <!-- and end with -->

            I have try <!--*--> but it doesn't work

            6,685587
            Grand MasterGrand Master
            6,685587

              Jun 16, 2005#6

              I activated my brain and found (in 10 minutes!) hopefully the best solution for this special purpose. The following macro does, what you want. There are some special extras included.

              [ ^t^p]++ deletes spaces, tabs and line breaks following the comment, if they exist. This avoids also creating a empty line instead of a multiline block comment.

              The IfFound command after "-->[ ^t^p]++" is needed to exit loop at bad commented html files, where the comment end is missing (Frontpage sometimes creates such bad comments), letting the cursor at start of this bad comment.

              The macro can also be use for replacing single line html comments.

              InsertMode
              ColumnModeOff
              HexOff
              UnixReOff
              Top
              Find RegExp "<!--[~-]+-->[ ^t^p]++"
              Replace All ""
              Loop
              Find "<!--"
              IfFound
              StartSelect
              Find RegExp Select "-->[ ^t^p]++"
              IfFound
              EndSelect
              Delete
              Else
              ExitLoop
              EndIf
              Else
              ExitLoop
              EndIf
              EndLoop


              To delete empty space before line comment starts, use this alternative macro:

              InsertMode
              ColumnModeOff
              HexOff
              UnixReOff
              Top
              Find RegExp "[ ^t^p]++<!--[~-]+-->[ ^t^p]++"
              Replace All ""
              Loop
              Find RegExp "[ ^t^p]++<!--"
              IfFound
              StartSelect
              Find RegExp Select "-->[ ^t^p]++"
              IfFound
              EndSelect
              Delete
              Else
              ExitLoop
              EndIf
              Else
              ExitLoop
              EndIf
              EndLoop


              The last macro makes sure, that the "comments" around css and javascript code in head is not deleted.

              InsertMode
              ColumnModeOff
              HexOff
              UnixReOff
              Top
              Find <body
              IfNotFound
              ExitMacro
              EndIf

              Find RegExp "[ ^t^p]++<!--[~-]+-->[ ^t^p]++"
              Replace All ""
              Top
              Find <body
              IfNotFound
              ExitMacro
              EndIf

              Loop
              Find RegExp "[ ^t^p]++<!--"
              IfFound
              StartSelect
              Find RegExp Select "-->[ ^t^p]++"
              IfFound
              EndSelect
              Delete
              Else
              ExitLoop
              EndIf
              Else
              ExitLoop
              EndIf
              EndLoop

              Ooppss, I had to insert an additional body search from top at last macro.
              Best regards from an UC/UE/UES for Windows user from Austria

              cporeaux
              cporeaux

                Jun 16, 2005#7

                I am incapable to write macro. That is because despite I have read the guide. I didn't succeed to write macro and to modify that you are written.

                (for example to add "the replace of page break" I can only that it need of add the string "^B" but making this, the macro doesn't work)

                For this reason I ask you: if you know a website where try example of macro or if you know a guide (not the guide of UltraEdit that is little explicative in respect to this).

                I certainly will have new exigency and I will have need to make new macro.

                Let me know

                6,685587
                Grand MasterGrand Master
                6,685587

                  Jun 16, 2005#8

                  What do you understand as page break?

                  UE means a single, normally not visible character with hexcode 0C. That's not a <br>, <p> or <hr>!

                  I don't know, if a guide for UE macro exist. I never needed one. I simply learned it by reading manual, recording macros and modifying the macro code after record. My first macros and regular expressions were also very simple and not so complicated as this one. Learning by doing is always the best method. But do not start with a tricky one. First you have to learn to crawl, before walking or running!

                  I have planned to create a collection of my best and most useful UE macros with detailed description and some test files for every macro. But at the moment I have no time to spend a lot of hours for creating this collection. So the only advice I can give to you at the moment is, read as much posts in the macro and find/replace forum as possible and try to understand, how the works.
                  Best regards from an UC/UE/UES for Windows user from Austria

                  cporeaux
                  cporeaux

                    Jun 16, 2005#9

                    Mofi wrote:What do you understand as page break?

                    UE means a single, normally not visible character with hexcode 0C.
                    Exactly, I understand that,
                    Mofi wrote:InsertMode
                    ColumnModeOff
                    HexOff
                    UnixReOff
                    Top
                    Find RegExp "<!--[~-]+-->[ ^t^p]++"
                    Replace All ""
                    Loop
                    Find "<!--"
                    IfFound
                    StartSelect
                    Find RegExp Select "-->[ ^t^p]++"
                    IfFound
                    EndSelect
                    Delete
                    Else
                    ExitLoop
                    EndIf
                    Else
                    ExitLoop
                    EndIf
                    EndLoop
                    I ask you last thing. How come modified this macro if I wanted erase also the page break? "^b" where must I add it?

                    6,685587
                    Grand MasterGrand Master
                    6,685587

                      Jun 16, 2005#10

                      It depends, where the page break is.

                      If inside the comment, it should be automatically ignored, although I have not tested it.

                      If after the comment, add it in both [ ^t^p]++, so it looks like [ ^t^p^b]++.

                      Important: lower case ^b and not uppercase!
                      Best regards from an UC/UE/UES for Windows user from Austria