How do you search and replace multiple lines in KDE Kate?

5,122

Through Ctrl+R you switch into the search & replace mode. In the bar on the bottom, you first have to select as Mode either Escape sequences or Regular expressions.

For instance, if you choose Escape sequences, click the right mouse button on the search field. A context menu appears with an item called Add, listing some valid escape sequences, among which you will find \n. The same apples for the replace line edit. The context menu is also available in the Regular expressions mode.

Share:
5,122

Related videos on Youtube

iembry
Author by

iembry

Updated on September 18, 2022

Comments

  • iembry
    iembry over 1 year

    how do you replace multiple lines of code in Kate?

    The following is the original text:

    <div id="image">
    <br style="clear: left"/>
    <br style="clear: left"/>
    <br style="clear: left"/>
    <!-- Begin logo -->
    ...
    <!-- End logo -->
    </div>
    

    This is the text that I would like to have:

    <div id="image">
    <!-- Begin logo -->
    ...
    <!-- End logo -->
    </div>
    
    • jordanm
      jordanm over 9 years
      kate's search and replace only works on a single line.
  • Oliver Coleman
    Oliver Coleman over 6 years
    Just to clarify: an explicit \n is necessary even when other constructs might ordinarily match line breaks: <font[^>]*>(([^<]|\n)*)</font> and <font[^>]*>([^<]*)</font> behave differently: the former will match across line breaks and the latter does not.