[R] Regular Expressions
Noah Silverman
noah at smartmediacorp.com
Fri Nov 5 07:55:09 CET 2010
Hi,
I'm trying to figure out how to use capturing parenthesis in regular
expressions in R. (Doing this in Perl, Java, etc. is fairly trivial,
but I can't seem to find the functionality in R.)
For example, given the string: "10 Nov 13.00 (PFE1020K13)"
I want to capture the first to digits and then the month abreviation.
In perl, this would be
/^(\d\d)\s(\w\w\w)\s/
Then I have the variables $1 and $1 assigned to the capturing parenthesis.
I've found the grep and sub commands in R, but the docs don't indicate
any way to capture things.
Any suggestions?
Thanks!
-N
More information about the R-help
mailing list