0

See this sentence below:

A space of creation conceived as a <em>full</em>attributed to myself.

You see that is no space before and after </em>

So, I need to find al words between html tags, that have no space before <em> and after </em>, and to make a replacement as to put a new space before/after.

Of course, the simple solution is to make a simple search and replace with (space)</em>(space) , but a regex will be much better, so as not to be 2 spaces like can be in simple replace.

I try this, but I believe the replacement is not working:

FIND: (?!\w)(<em>.*?</em>)(?!\w)

REPLACE BY: \1 \2 \3

3

1 Answer 1

0

This regex will add a space before and after | if there is none.

Use the following:

  • Ctrl+H
  • Find what: (?!\x20)(<em>.*?</em>)(?!\x20)
  • Replace with: \x20\1\2\3\x20
  • CHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all
3
  • 1
    Could you explain how the regular expression works at least? It is an answer to a very specific beginners problem. Without explaining how the solution works, I see not much value to other users. Commented Aug 22, 2022 at 13:10
  • simple. My regex will add a space before and after <em>|</em> if there are non.
    – Just Me
    Commented Aug 22, 2022 at 16:21
  • 1
    Please edit your answer with the additional information instead of adding it as a comment. You are here for nearly 6 years, you should know how it goes. Commented Aug 22, 2022 at 17:28

You must log in to answer this question.

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