Robert Feldt <feldt / ce.chalmers.se> wrote: > >Hi, > >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. A Ruby regexp can contain any set of balanced parens. Balanced parens are a classic problem that is unsolvable in a regular expression. Keep in mind that regular expressions are methods of stating a pattern to look for. They are not a general parsing tool. Attempting to use them as the latter is like using a hammer as a screw-driver. It kinda works until you have a delicate problem... Instead use regular expressions to find tokens and then proceed with standard parsing techniques. Cheers, Ben _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com