"Wolfgang NŠŇasi-Donner" <wonado / donnerweb.de> writes:

> In detail a regular expression that consists only of a named group
> definition (starts with '(?<name>') kann be registered by something
> like 'Regex.register(/(?<example>a|b|c|d)/)', and be deleted by
> Regex.remove('<example>'). If the regular expression is assigned to a
> variable this can be used, how to manage this in the 'remove' case has
> to be clearified. I used class methods for this example, but it may be
> better to introduce a named Regexp objects which will be created by
> something like '/(?<example>a|b|c|d)/.create. Some possibility for
> explicit deletion should be there, because the regex engine Oniguruma
> must know about the object to take care about.
>
> These Object can later on be referenced in regular expressions by
> \k<name>' or '\g<name>' as if they were defined there.

Can't we do that already?

  example = /a|b|c|d/
  mybigregex = /#{example}|foo/

If you need more scope, use constants.

> Wolfgang NŠŇasi-Donner
-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org