stringA="a; b; c; d; e; f; g; h; i; j;"stringB <- sub("^((?:[^;]*;){4}).*", "\\1", stringA)stringB## "a; b; c; d;"
Standard input is empty
[1] "a; b; c; d;"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!