Fix issue #515 , done ! :)
Instead of (\s+)? how about \s*?
It's simpler and doesn't create captures that we aren't using.
I try your suggestion and found that
I'm not good at regex, so not sure what make it behaves like that. What do you think ?
There are a few things going on here:
So the (\s+)? means that the group must capture one or more whitespace characters, but the question mark then says that the capture group doesn't have to match in order for the regexp as a whole to match.
Since we don't actually care about the whitespace we don't need to capture it. It leads to some confusion in reading the code.
Instead, s/\s*:+\s*/::/g should do what you want:
Match any number of colons, which might (or might not) be surrounded by any number of whitespace characters (zero or more), discard the whitespace, and make the number of colons exactly two.
Remove white space next to colon on keyword suggestion
That's really useful, I will print it out and stick on the wall 👍 , pushed new fixed regex and squashed it. Thanks a lot for your suggestion :D
Looks good. Thank you!