Regular expression question

Thanks all. Now it works. The final form is
/^#|^\s*$/

RR

···

-----Original Message-----
From: Gennady F. Bystritsky [mailto:gfb@tonesoft.com]
Sent: Tuesday, December 03, 2002 6:35 PM
To: ruby-talk ML
Subject: Re: Regular expression question

Well, Ruby regexps are not VI regexps. Look similar to some
extend, but still different. VI implements BRE, and Ruby is
closer to ERE (like in awk, egrep, etc.). Plus a lot of other
nice features.

----- Original Message -----
From: “Roman Rytov” rrytov@entopia.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Tuesday, December 03, 2002 8:28 AM
Subject: Re: Regular expression question

My pattern works fine in VI. Back slash before (,) and | is
needed to assign special meaning to them.

-----Original Message-----
From: Shannon Fang [mailto:xrfang@hotmail.com]
Sent: Tuesday, December 03, 2002 6:22 PM
To: ruby-talk ML
Subject: Re: Regular expression question

line !~ /\(^#\)\|\(^[\s\t]*$\)/

I think you just need to use ( not (, I suppose it should be

line !~ /^#|^\s*$/

if you don’t need to reference I think no () is needed. And
\s should
include whitespace and \t?

I replaced already it to \S so the pattern now is
(^#)|(^\S*$)

Nevertheless it doesn’t work yet:-)

Shannon


Protect your PC - get McAfee.com VirusScan Online
Antivirus, VPN, Identity & Privacy Protection | McAfee