[R] Regular Expressions

Shubha Vishwanath Karanth
Tue, 13 May 2008 09:02:31 -0000

Hi R,



Again struck with regular expressions...



Suppose,



S=c("World_is_beautiful",
"one_two_three_four","My_book")



I need to extract the last but one element of the strings. So, my output should
look like:

Ans=c("is","three","My")



gsub() can do this...but wondering how do I give the regular expression....







Shubha Karanth | Amba Research

Ph +91 80 3980 8031 | Mob +91 94 4886 4510

Bangalore * Colombo * London * New York * San José * Singapore *
www.ambaresearch.com



This e-mail may contain confidential and/or privileged i...{{dropped:13}}