Converta espaços em guias no RegEx

Como você diz o seguinte na regex:

foreach line
   look at the beginning of the string and convert every group of 3 spaces to a tab
   Stop once a character other than a space is found

Isso é o que eu tenho até agora:

/^ +/\t/g

No entanto, isso converte todos os espaços em uma guia

Qualquer ajuda seria apreciada.

questionAnswers(3)

yourAnswerToTheQuestion