From: pete@... (Peter J. Kernan) Date: 2001-08-24T02:28:24+09:00 Subject: [ruby-talk:20192] Re: [q] question about ruby regex On Thu, 23 Aug 2001 12:38:40 +0900, Dave Thomas was ready with: ||"丞 旦 枢" writes: || ||> Hi. ||> ||> I've been trying to match C-style comment in ruby regex. ||> ||> my wrong approach is as follows. ||> ||> case str ||> when /\/\*[^(\*\/)]*\*\// || ||you could try: || || when %r{/\*.*?\*/}m || that will also grab non-comments, such as printf("/* not a comment */\n"); i once wrote a C comment grabber in perl which i think is correct (passed all of the tests i could think of), but havn't bothered to convert it to ruby re's yet. here it is: my $even_slashes = qr{(?) { print "$_\n" for grep {defined} /$re/g; } Pete -- screwbean: a shrub or small tree found in the US Desert Southwest