1

How to replace two strings at once with one in Notepad++ using regular expressions?

I need this:

================
================

Replace with this:

--------------
4
  • 2
    I’m voting to close this question because questions must demonstrate a reasonable amount of research & understanding of the problem being solved. Please edit to either a) clearly describe your problem and the research done so far to solve it or b) include attempted solutions plus why they didn't work. In either case, be sure your expected results are clearly presented.
    – Tetsujin
    Commented Sep 6, 2022 at 18:43
  • That's simple to do. What have you tried and what didn't work?
    – Toto
    Commented Sep 6, 2022 at 18:58
  • @Toto I tried like this: \r\n=======. This moves up a line.
    – moninah
    Commented Sep 6, 2022 at 20:00
  • Does this answer your question? Notepad++ regex command for searching two following lines Commented Sep 6, 2022 at 22:14

1 Answer 1

3

By "two strings", I suppose you mean two lines.

Globally, it can be achieved by seeing the two lines as a single string containing a new line character. So the regular expression (RegEx) pattern should be something like that:

<first line pattern><new line character><second line pattern>

The new line pattern can be either \r\n or \n depending of the file, you should test the both.

For your specific case, the match pattern should be the following

=+\r\n=+

=+ means at least one = sign. + is greedy, so it will take all = sign if there are more than one.

1
  • Exactly. Thanks a lot!
    – moninah
    Commented Sep 6, 2022 at 20:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .