From: Arlen Cuss Date: 2012-10-29T10:25:39+09:00 Subject: Re: Newbie : Regular expression Hi Muhammad, That depends entirely on what the value of "r" is. The #{} is interpolation, like in strings. e.g. r = /boo/ regexp = Regexp.new("(^#{r}$)") regexp is now /(^(?-mix:boo)$)/, which is basically the same as saying /(^(?:boo)$)/, .. which is basically the same as /(^boo$)/ in this context. In other words, the value of "r" gets included there, with any options on the regexp "r" set. If "r" is a String, its value is included verbatim, as if it was part of the regexp source. Cheers, Arlen On Monday, 29 October 2012 at 12:14 PM, Muhammad Salman wrote: > Hi, > > Can some one please tell me of an example expression which maps to this > regex > > "(^#{r}$)" > > The ruby statement is > > regex = Regexp.new("(^#{r}$)") > > -- > Posted via http://www.ruby-forum.com/.