From: Randy Kramer Date: 2007-10-19T20:36:39+09:00 Subject: Re: Compound conditionals in case when statements? Syntax? On Wednesday 17 October 2007 01:46 pm, Randy Kramer wrote: > On Wednesday 17 October 2007 01:25 pm, Randy Kramer wrote: > > I've tried the suggested approaches and variations that I could think of, > and still no luck. Ok, for the record I got it to work--here's a little working test program: #! /usr/bin/env ruby new_record = true line = "---++ tasty" case when (new_record and /^---\+\+ (.*)/ =~ line) puts "a title if at the beginning of a record: " + $1 when /^---\+\+ (.*)/ =~ line puts "a level 2 heading if not at the beginning of a record: " + $1 else puts "neither a title nor a level 2 heading" end My mistake was leaving "line" after "case" when I tried to switch to the alternate form of case statement. Sometimes (or more often ;-) I can be pretty dense. (And, of course, the other thing I finally did was make a small test snippet of the code for experimentation.) Randy Kramer