smple_paths <- c("/path/path/path/abc22/path/path", "/apath/apath/paath/abc11/something/path")sub(".*(abc\\d{2}).*", "\\1", smple_paths)
Standard input is empty
[1] "abc22" "abc11"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!