Ryan Ryan - 2 months ago 22
Sass (Sass) Question

Ensure exactly one space after each colon in CSS in Netbeans

I'm editing old SCSS in Netbeans and want to format it to be prettier.

I want to do a regex "find and replace" on all colons that are not followed by a space. I want to ensure that exactly one space follows each colon.

Here is some sample SCSS:

display: block;
width:800px;
height:20px;
text-align:center;


The regex would ignore the first line and then for the next 3 lines would add a space after each colon.

I know there are special corner cases such as
input.focus::-webkit-input-placeholder
. I could do each find-and-replace one by one rather than "replace all". I could then skip over the corner cases.

If there is a non-regex way to do this, that would work too.

Answer

Try this search

([a-zA-Z0-9]:)([a-zA-Z0-9#])

And replace it with

$1 $2
Comments