$string=" hi hello @begintobe replace @end asas x x x x x zxzxax hi hello hi hellooo @beginthis has tobe replaced @end" ..... i had @replace=["replacestring1","replacestring2"....] i need to have my string like. $string=" hi hello @begin replacestrinjg1 @end asas x x x x x zxzxax hi hello hi hellooo @begin replacestring2 @end" .....