I want to find and replace all whitespace that is shown below between $‘s with just a single space.
NOTE: I added the $‘s manually to show you what I was looking to match. They are not actually present in the code – because if they were, it wouldn’t compile!
CClient::CClient$ $(Callback& callback):
SecurityInfo$ $(NULL),
ConnectInfo$ $(NULL),
Session$ $(NULL),
Id$ $(NULL),
MyCallback$ $(callback),
{
unsigned long$ $something = 0;
ConnectionId$ $= NumberOfClients++;
SecurityInfo$ $= new SecurityInfoClass$ $();
ConnectInfo$ $= new ConnectInfoClass$ $();
Here’s what I have so far:
s/(?<!^)(?: ){2,}+|\t+(?=\S)/ /g
It works OK, but the check for the beginning-of-line doesn’t work as I expected.
Thanks in advance.
I’m guessing you want something like:
Accepted this: