I would like to replace each two spaces from the beginning of each line, with a tab. I tried the following:
s/^(\s{2})+/\t/gm;
it didnt work.
If you're reading the file line by line:
$line =~ s/\G[ ]{2}/\t/g;
If you've slurped the entire file:
$file =~ s/(?:\G|^)[ ]{2}/\t/mg;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With