beware that regex in VI are different of regex in Ruby
with Ruby, you have to backslash ( to have NO regex sens (only caractere
sens),
with VI, you have to backslash ( to have meaning (only regex sens)
hope this help
···
On Tue, 2002-12-03 at 17:28, Roman Rytov wrote:
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*$)
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*$)