On Mon, Jun 13, 2011 at 10:26 PM, m b <snert / hotmail.se> wrote: > > > >> > > if I do this: >> > > >> > > f=open('filename.dat','r') >> > > str=f.read >> > > >> > > and then: >> > > >> > > str.each_line ¨Âüìéîåü >> > > ruby/.match(line) >> > > >> > > ruby prints out variable line and say its a RegexpError >> > > 'empty range in character class' ¨Âéæ éô éîôåòðòåôó ¨Âéîáó áåçåøð >> > > What am I doing wrong? ¨Âèåòå áòìïïæ óôòáîçãèáòáãôåòó éî öáòéáâìå ìéîå>> > > maybe that is the issue? You must have a different regular expression in your test other than /ruby/ because that is valid: irb(main):001:0> m = /ruby/.match "text" => nil irb(main):002:0> m = /ruby/.match "ruby" => #<MatchData "ruby"> > I found out what I was doing the wrong way.. > > I'm reading the search pattern with ¨Âåáäìéî> and I wrote it -->/ruby/ > That didnt make it a Regexp. This is not true. The sequence /ruby/ *is* a valid regular expression. 10:01:30 ~$ ruby19 -e 'p /ruby/' /ruby/ 10:01:38 ~$ ruby19 -e 'p /ruby/.class' Regexp 10:01:42 ~$ There must be something else going on. Please post your _complete_ code you actually have. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/