Re: [R] Regexp question

From: Jerome Asselin <>
Date: Wed, 04 May 2011 16:31:29 -0400

On Wed, 2011-05-04 at 22:41 +0300, johannes rara wrote:
> I have a string like this
> st <- "SELECT COUNT(empid), COUNT(mgrid), COUNT(empname),
> COUNT(salary), FROM Employees"
> How can I remove the last comma before the FROM statement?

gsub(",[^,]*FROM ", " FROM ", st)

Jerome mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 05 May 2011 - 06:25:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 05 May 2011 - 07:00:07 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive