From: Robert Klemme Date: 2010-03-01T21:42:02+09:00 Subject: Re: gsub for string 2010/3/1 Reinhart Viane : > I'm looking for a function that makes it possible to do the folowing: > > Replace all  substrings --xxxx-- with -xxxx--1 in a string. > > The xxxx represents an unknown value (can be anything) > > Is there a way to set unknow characters in a gsub function? You can match arbitrary characters and use capturing groups str.gsub(/--([^-]+)--/, '-\\1--1') Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/