I have this example:
ED Ess Nb Ip
I would like to capture all whitespaces except the two present between "Ess" and "Nb".
ED·Ess Nb··Ip
Where ·
indicate what should be captured.
I have try:
(?<!Ess\s)\s
But it does not work since the Negative Lookbehind itself contains what should be captured.
Do you have a solution ?
CodePudding user response:
Seems like you have to use both negative lookbehind and lookahead to check if Ess
or Nb
is nearby.
/(?<!Ess)\s(?!Nb)/gm
P.S. I might notice that there is an edge case where the regexp would capture whitespaces if there are more than two present between Ess
and Nb
.