0

I have this lines, I need to make them all paragraph, <p class="mb-40px"></p> The first 2 lines, doesn't have html tags, but ending with inappropriate tag. And the third line has also the same inappropriate tag at the end , but had the right tag at the beginning.

Vă pare rău pentru ce aţi făcut?”<br />
”Can you love me?”<br />
<p class="mb-40px">Să ne imaginăm nişte răspunsuri ale agresorului.<br />

Must Become:

<p class="mb-40px">Vă pare rău pentru ce aţi făcut?”</p>
<p class="mb-40px">”Can you love me?”</p>
<p class="mb-40px">Să ne imaginăm nişte răspunsuri ale agresorului.</p>

My both regex are almost good, but duplicates the first tag in the third line

FIND: ^(.*)(<br />)$

REPLACE BY: <p class="mb-40px">\1</p>

OR

FIND: ^(?!<p>)(.+?)(<br />)$

REPLACE BY: <p class="mb-40px">\1<\p>

0

1 Answer 1

1
  • Ctrl+H
  • Find what: ^(?:<p class="mb-40px">)?(.+)<br />
  • Replace with: <p class="mb-40px">$1</p>
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all

Explanation:

^                           # begining of line
(?:<p class="mb-40px">)?    # non capture group, optional open p tag
(.+)                        # group 1, 1 or more any character
<br />                      # literally

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

You must log in to answer this question.

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