x <- c("[cat 00.04;09]", "[cat 00.04;10]")gsub('\\[cat[^]]*\\]', '[cat]', x)
Standard input is empty
[1] "[cat]" "[cat]"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!