Search code examples
regexsublimetext2adobe-brackets

Regex: how to find new line in code


I have a lot of html files with text without <p>. tags in the code. I try find and replace with Adobe Brackets or Sublime Text 2:

Find <br><br>\n
Replace </p>\n</p>

But they do not find the \n in the code

Simplified, now I have:

Some sentence, some sentence<br><br>
(I have one space here in the code)
Some sentence, some sentence<br><br>

I would like to convert:

Some sentence, some sentence</p>

<p>Some sentence, some sentence</p>

(I know I will have to add manually just one <p> at the beginning, this is not important and it is not the point of this question)


Solution

  • Find:(.*)<br><br>\n?
    Replace:<p>\1</p>\n
    

    InPut:

    Some sentence, some sentence<br><br>
    
    Some sentence, some sentence<br><br>
    

    OutPut:

    <p>Some sentence, some sentence</p>
    
    <p>Some sentence, some sentence</p>