Using regex to remove the first occurrence of white space and then replace the rest of the tabs with commas

前端 未结 1 1540
别那么骄傲
别那么骄傲 2021-01-24 08:54

Because I have lines like

space space **da ta** tab tab **data**
tab **data** tab tab tab tab **da ta**

I want the above to turn into



        
相关标签:
1条回答
  • 2021-01-24 09:49
    s/^[ \t]+//;  # remove leading whitespace (just once)
    s/[ \t]+/,/g; # replace all runs of spaces into commas globally
    
    0 讨论(0)
提交回复
热议问题