vim match csv line with commas

520 Views Asked by At

Im having trouble matching X number of commas in a csv file

sometext,moretext,moretext2,moretext3,moretext4

Im trying to match up to the 3rd comma, any help?

The best I have so far is:

/.\{3},
/.\{-},
/.\{0,3},

but none of those are doing it for me, what am I doing wrong?

1

There are 1 best solutions below

1
On BEST ANSWER

This will match upto the third comma

/^\([^,]\+,\)\{3\}