x <- c("/canais/b3/conheca-o-pai-dos-indices-da-b3/","/canais/cpbs/cvm-abre-audiencia-publica-de-instruc","/canais/stocche-forbes/dividendo-controverso/")sub("^(/canais/[^/]+/).*", "\\1", x)
Standard input is empty
[1] "/canais/b3/" "/canais/cpbs/" [3] "/canais/stocche-forbes/"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!