#!/bin/bashs="Text... f[3][2,3][4] ...text"sed -E 's/(f\[[0-9]*]\[[0-9]*,[0-9]*])\[([0-9]*)]/\1["string"][\2]/g' <<< "$s"
Standard input is empty
Text... f[3][2,3]["string"][4] ...text
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!