we first use index to find out the qid position and then reset the position pointer by using pos function. From there, we can use s//g to replace the string to the desired string. the /g modifier has to be added to make the position pointer change in effect. The other stuff should be pretty clear to you now!!