From: Mmcolli00 Mom Date: 2009-01-20T05:45:02+09:00 Subject: Regular Expression {m,n} File.open("patientrecords.txt", 'r') do |p| if p.gets =~ /%{2,3}PersonID/ then puts "PersonID exist twice" end end Hi. This is supposed to tell me if there a line in my text file that contains 'PersonID' at least 2 times and at most 3 times. I have been playing with regular expressions and thinking {m,n} would help with this. This snippet is used to show me if it will actually work. (Some lines contain PersonID only once, I do not want to use those lines) Thanks, MC -- Posted via http://www.ruby-forum.com/.