Sublime Text regex to find and replace whitespace between two xml or html tags?

You have just to use a simple regex like:

\s+

And replace it with with a comma.

Working demo

enter image description here


This will find instances of

<tags>...</tags> 

with whitespace between the tags

(<tags>\S+)\W(.+</tags>)

This will replace the first whitespace with a comma

\1,\2

Open Find and Replace [OS X Cmd+Opt+F :: Windows Ctrl+H]

Use the two values above to find and replace and use the 'Replace All' option. Repeat until all the whitespaces are converted to commas.

The best answer is probably a quick script but this will get you there fairly fast without needing to do any coding.