How to remove unwanted space in html tags?
My html code has some errors
It contains space inside the html tags
Correct ones like
The current code is like
</ p> or </ div>
How to trim/strip all space inside <> by RegEx in Notepad++?
Thanks in advance for sharing your RegEx wisdom.
Try this S/R regex:
Search: (?<=</)\x20+(?=\w+>) Replace: [leave empty]
Thanks for the reply.
I tried the code
It does not seem to be taking an effect
Here is the code
The regex works fine for the provided examples, as I tested on Notepad++.
For the new examples, try this one:
Search: (?-s)< *?(/\w+) *?> Replace: <$1>
NZ Select last edited by NZ Select
(?-s)< *?(/\w+) *?>
Thank you, it indeed works in Notepad++
What if I also want to remove like < / div >, in which the forward slash and div has a space?
Here is the screenshot:
astrosofista last edited by astrosofista
I was expecting that one :) Easy to solve, indeed, the new regex solves this and the previous ones:
Search: (?-s)< *?(/) *?(\w+) *?> Replace: <$1$2>
A big thank you, it solved my problem beautifully.
Amazing RegEx code!
Saving me hours of work.
And I hope it is helpful for other people who want to remove the tags as well.
Thank you @astrosofista
You’re welcome. Glad to be of help.
If you want to get involved in regex —is not that hard—, let me suggest you to take a look at this page:
Hope this helps.
Thank you for the resource.
WinterSilence last edited by
use tiny/xml plugin