I'd need a Javascript function to remove leading and trailing whitespaces between asterisks.
Eg. to transform this string:
Hello **world **how are you?
Into
Hello **world** how are you?
Also
Hello ** world** how are you?
Into the same result.
Which would be to make that markdown type string input valid.
I do not need a regex alone but a way to achieve this. I tried /\*\*(\S(.*?\S)?)\*\*/gm
for a particular word between asterisks but it wouldn't serve purpose on an entire string.