I am trying to format my code in the way I prefer, i.e. each line should be indented in groups of 4 spaces, depending on how “deep” this line is in the code (for example, children should get 4, except for their parent).
Currently, everything has 1 space (sample from my code):
<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="style.css">
<script src="jquery.js"></script>
<script src="loadfiles.js"></script>
</head>
...
I would like him to have 4 places for the first level, 8 for the second, etc. So basically multiply the sum by 4.
I tried the Regex replace command:
^ (.*)$ // search for
$1 // replace with
But this only replaces the first space of each line with four spaces. How can I make it replace 2 spaces with 8 spaces, etc.?
Thank.
source
share