try this: > x [1] "OYS-PIA2-FL-1" "OYS-PIA2-LA-1" "OYS-PI-LA-BB-1" "OYS-PIA2-LA-10" > sub("^.*?([0-9]+)$", "\\1", x) [1] "1" "1" "1" "10" >
On Tue, Dec 11, 2012 at 12:46 PM, Steven Ranney <steven.ran...@gmail.com> wrote: > OYS-PIA2-FL-1 > OYS-PIA2-LA-1 > OYS-PI-LA-BB-1 > OYS-PIA2-LA-10 -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.