Regex for indenting lines
I'm trying to mass indent my code in the way I prefer it - that is, each line should be indented by groups of 4 spaces, depending on how 'deep' that line is in code (e.g. children elements should get 4 extra than their parent).

Currently everything has 1 space (a 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'd like to have it get 4 spaces for the first level, 8 for the second etc. So basically multiply the amount with 4.

I tried this Regex replace command:

    ^ (.*)$      // search for
        $1       // replace with

But this only replaces the first space  of each line with 4 spaces. How can I also make it replace 2 spaces with 8 spaces etc.?

Thanks.
Regex for indenting lines
===

I'm trying to mass indent my code in the way I prefer it - that is, each line should be indented by groups of 4 spaces, depending on how 'deep' that line is in code (e.g. children elements should get 4 extra than their parent).

Currently everything has 1 space (a 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'd like to have it get 4 spaces for the first level, 8 for the second etc. So basically multiply the amount with 4.

I tried this Regex replace command:

    ^ (.*)$      // search for
        $1       // replace with

But this only replaces the first space  of each line with 4 spaces. How can I also make it replace 2 spaces with 8 spaces etc.?

Thanks.