From: Yaser Sulaiman Date: 2008-12-02T04:34:48+09:00 Subject: Re: Regular Expressions ------=_Part_94637_32713648.1228160415364 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I'm not sure if this is what you are asking for, but /23430000.*CodeRed/ will match a line that contains '23430000', followed by zero or more characters, and then 'CodeRed'. try in IRB: irb(main):001:0> line1 = '23430000 @#$#$3455000CodeRed 24AAWERE 740000000' => "23430000 @\#$\#$3455000CodeRed 24AAWERE 740000000" irb(main):002:0> line1 =~ /23430000.*CodeRed/ => 0 irb(main):003:0> line2 = '23430000 @#$#$3455000CodeGreen 24AAWERE 740000000' => "23430000 @\#$\#$3455000CodeGreen 24AAWERE 740000000" irb(main):004:0> line2 =~ /23430000.*CodeRed/ => nil Regards, Yaser Sulaiman On Mon, Dec 1, 2008 at 10:08 PM, Mmcolli00 Mom wrote: > Hi everyone. > > Just a question about regualar expression in Ruby. Is there a way to > check in each line of a document for always beginning with "23430000" > and somewhere on that same line another string 'CodeRed'? > > line1: 23430000 @#$#$3455000CodeRed 24AAWERE 740000000 > > This is what I have so far when I import each textdata from another > file. > > > textdata.should =~ /23430000/ |CodeRed/ > > ...the pipe was supposed to determine if CodeRed exists somewhere after > the identity code 23430000. However, it doesn't work like this. Also for > my code I am not using OR logic with it. > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_94637_32713648.1228160415364--