I have a file that has the general form as
number,number,string
and i want to delete both the numbers from each line and extract only the string. What would the regexp be?
You can use:
:s/^[0-9]*,[0-9]*,//
For the whole file, that's:
:%s/^[0-9]*,[0-9]*,//
A good regular expression may be:
/^\(\s*[+-]*[[:digit:]]*\.*[[:digit:]]\+,\s*\)\{2}/
This will match numbers, including an optional sign and an optional decimal point (assuming you use .
in your locale) followed by a comma and optional whitespace twice at the beginning of the line.
Usage:
:%s/^\(\s*[+-]*[[:digit:]]*\.*[[:digit:]]\+,\s*\)\{2}//
Add hex digits ([[:xdigit:]]
) to taste.
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