From: Ludo Date: 2002-12-04T01:33:14+09:00 Subject: Re: Regular expression question --=-MMVc5t9KtF+56Pep1eiJ Content-Type: text/plain Content-Transfer-Encoding: 7bit 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*$\) > > Nevertheless it doesn't work yet:-) > > > > > Shannon > > > > _________________________________________________________________ > > Protect your PC - get McAfee.com VirusScan Online > > http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 > > > > > > -- Ludo ENIB/LI2 --=-MMVc5t9KtF+56Pep1eiJ Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit 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*$\)

Nevertheless it doesn't work yet:-)

> 
> Shannon
> 
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online 
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> 
> 
> 
--
Ludo <coquelle@enib.fr>
ENIB/LI2
--=-MMVc5t9KtF+56Pep1eiJ--