From: kotin 76 Date: 2011-07-28T01:12:34+09:00 Subject: Re: if condition for pattern matching hi , as per jake reply, i tried the below code 1 string1 = '/dev/sda1' 2 3 if string1 =~ %r{/dev/} then 4 puts "pass" 5 end its working fine. Thanks every one for quick replys. Regards kotin kotin 76 wrote in post #1013391: > Hi all, > > i tried as per you suggestions from below program > > 1 string1 = '/dev/sda1' > 2 > 3 if string1 =~ //dev\ then > 4 puts pass > 5 end > > But i getting below error. i think i may done mistake at regular > expresson under if condition. Please sugget regular expression under if > condtion to enter in to loop. i am looking for regular expression to > enter into loop if it find "dev" in given string. > > > ######################################## > 7.rb:3: unknown regexp options - dv > 7.rb:3: syntax error, unexpected $undefined, expecting keyword_then or > ';' or '\n' > if string1 =~ //dev\ then > ^ > 7.rb:5: syntax error, unexpected keyword_end, expecting $end > ########################################## -- Posted via http://www.ruby-forum.com/.