var s = "dynamic_fields[n][key]".replace(/[(n)]/g,1);print(s);
Standard input is empty
dy1amic_fields[1][key]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!