Konwertuj spacje na zakładki w RegEx

Jak to zrobić w wyrażeniu regularnym:

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

Oto, co mam do tej pory:

/^ +/\t/g

Jednak konwertuje każdą spację na kartę 1

Każda pomoc byłaby doceniana.

questionAnswers(3)

yourAnswerToTheQuestion