Basic Regex question

dumb question perhaps, but how do I do a Ruby based regex expression
that takes the following as input and produces the following as
output:

INPUT: "#{some_string}" # or perhaps if the # needs escaping this
should be "\#{some_string}"
OUTPUT: "some_string"

i.e. what do I put in: "#{some_string}".match("???")

thanks in advance

# dumb question perhaps, but how do I do a Ruby based regex expression
# that takes the following as input and produces the following as
# output:
# INPUT: "#{some_string}" # or perhaps if the # needs escaping this
# should be "\#{some_string}"
# OUTPUT: "some_string"
# i.e. what do I put in: "#{some_string}".match("???")

something fr,

re=/\#\{(.*?)\}/
#=> /\#\{(.*?)\}/

s="\#{some_string}"
#=> "\#{some_string}"

s.match(re).captures
#=> ["some_string"]

···

From: Greg Hauptmann [mailto:greg.hauptmann.ruby@gmail.com]

excellent - thanks heaps

···

On Wed, Sep 17, 2008 at 11:34 AM, Peña, Botp <botp@delmonte-phil.com> wrote:

From: Greg Hauptmann [mailto:greg.hauptmann.ruby@gmail.com]
# dumb question perhaps, but how do I do a Ruby based regex expression
# that takes the following as input and produces the following as
# output:
# INPUT: "#{some_string}" # or perhaps if the # needs escaping this
# should be "\#{some_string}"
# OUTPUT: "some_string"
# i.e. what do I put in: "#{some_string}".match("???")

something fr,

re=/\#\{(.*?)\}/
#=> /\#\{(.*?)\}/

s="\#{some_string}"
#=> "\#{some_string}"

s.match(re).captures
#=> ["some_string"]