Hello !

> Ex:
> str = " /* startdel1 */ text1 text1 text1 /*enddel1*/ /*startdel2*/
> text2  text2  text2 /*enddel2*/ /*startdel3*/ text3 text3 text3
> /*enddel3*/ "
> 
> In this example i'want to replace the string /*startdel2*/ text2 text2
> text2 /*enddel2*/
>                                                                by
>                                                               
> /*startdel2*/ hello /*enddel2*/

left = "/*startdel2*/"
right = "/*enddel2*/"
p str.gsub(/#{Regexp.quote(left)}(.*?)#{Regexp.quote(right)}/m,
           "#{left}hello#{right}")

  You need the /m as there might be newlines in the match, and you need
the Regexp.quote as your strings contain characters which lose their
usual meaning in a regexp (*).

  Cheers !

	Vince