hi Rousan,

  an example of what you've tried would make things much better and
easier (no one wants to do your work for you!)  i had a similar issue
dealing with parsing html pages, and i wound up writing a method for the
String class which replaces the text between one marker within a string
and another.  it takes 3 or 4 arguments - 1st is a sub-string that is
the starting point marker, 2nd a sub-string that is the end point
marker, 3rd the new text to go between the markers, and an optional 4th
which makes the method global - and it happens to work with your
example ;)
  some things to maybe think about:
  convert the first two arguments to Regexp's.  the =~ operator will
give you the index of your Regexp within the main string...  this can be
very useful.  i make a range between the index of the first marker and
the second (actually the index of the end of the first and the beginning
of second, but you get the idea,) and iterate through each index of the
string between them to create a new string to be replaced, and then use
#sub! (or #gsub! if global is true) to replace it with the 3rd argument
of the method.
  i'm sure that other folks have come up with better ways to do this as
well...  show us what you're working with!

  - j

-- 
Posted via http://www.ruby-forum.com/.