Try this:

gsub(".*_.*_(.*)_.*", "\\1", "abcd_efgh_12ab3_dfsfd")

On Thu, Feb 10, 2011 at 9:42 AM, Yan Jiao <y.jiao@ucl.ac.uk> wrote:

> Dear R gurus,
>
>
>
> If I got a vector with string characters like "abcd_efgh_12ab3_dfsfd",
> how could I extract "12ab3", which is the characters after second
> underscore and before the third underscore?
>
>
>
> Tons of thanks
>
>
>
> yan
>
>
>
>
>
>
> **********************************************************************
> This email and any files transmitted with it are confide...{{dropped:10}}
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

