>>>>> "T" == TAKAHASHI Masayoshi <maki / rubycolor.org> writes:

T> Shugo Maeda proposed Regexp#to_s and Tanaka Akira implemented it.
T> It's also used to substitute Regexp-in-Regexp as its source. For
T> example, when pat1 is /b.*c/, /a#{pat1}d/ is same as /a(?:b.*c)d/.

 There are well known problems with this

 pat1 = /(.).\1/ and /(a)#{pat1}d/ give /(a)(?:(.).\1)d/

 This is why regexp overload in a P language was partly a failure.

 And this is precisely a case where shared sub-pattern associated with
 named group can be usefull.




Guy Decoux