David Alan Black wrote:
> ...
> On Tue, 27 Feb 2001, Joseph McDonald wrote:
> 
> >
> > Is there a shortcut like:
> > if ((command) = part =~ /#{@pre}\s*(.*?)\s*#{@post}$/s)
> >       puts "command: #{command}"
> > end
> >
> > instead of:
> >
> > if (part =~ /#{@pre}\s*(.*?)\s*#{@post}$/s)
> >       command = $1
> >       puts "command: #{command}"
> > end
> 
> Try this:
> 
> command = /#{@pre}\s*(.*?)\s*#{@post}$/s.match(part)[1]
> puts "command: #{command}" if command
> 

Or this:

if command = /#{@pre}\s*(.*?)\s*#{@post}$/s.match(part)
	puts "command: #{command[1] || 'not found'}"
end


Guy N. Hurst

-- 
HurstLinks Web Development    http://www.hurstlinks.com/
Norfolk, VA  23510            (757)623-9688 FAX 623-0433
PHP/MySQL - Ruby/Perl - HTML/Javascript