this is my first post to stackoverflow, but I’ve used this amazing site before.
Anyway, I suck at regular expressions but I think I need them for what I need to do.
Short Question:
I need to replace the space ' ' with ' ' between any occurrence of <code></code>.
More details:
The motivation behind this was because my code sections were creating extra lines every other line because of the extra spaces (I’m asuming). By replacing the spaces with , I was able to format the code correctly.
However, this introduced a LOT of extra characters into my HTML. Not only is it inefficient, it also makes word-wrap: break-word; break the words in half rather than move the entire word down.
disclaimer: in no way do i think this is the solution you will neccessarily arrive at, some other answers already here address what you *should/could otherwise do to accomplish your task.
but let’s just assume you DID want to do it with regex. Since I think we can make the assumption that with
<code>stuff</code>, stuff won’t contain nested code tags, you can accomplish your short question with it, but you still need a couple steps: