On Wed, 10 Jan 2001, Robert Feldt wrote: > On Wed, 10 Jan 2001, Ben Tilly wrote: > > > >A q for you recursively minded folks out there: > > >Anyone got a Ruby regexp matching valid Ruby regexps? > > > > > Unless Ruby's Regexp engine has some extensions I have > > not heard about, this is impossible. > > > I had some doubts in the back of my mind but ruby-talk > folks generally seems to find ways to accomplish even the impossible. :-) > > Thanks for making this clear. I'll workaround the situation giving rise to > the q. Its not a big deal... Well... let's not give up yet :-) It depends exactly what you want to do. If you want to test for regexp validity, you could do something like: goodr = "^[abcde]$" badr = ".)" begin /#{goodr}/.is_a? Regexp /#{badr}/.is_a? Regexp rescue RegexpError => msg puts "test failed: #{msg}" end David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav