From: Ahmet Kilic Date: 2009-09-11T11:47:44+09:00 Subject: Re: regex: multiline Robert Klemme wrote: > 2009/9/10 Ahmet Kilic : >>>> end >>> irb(main):002:0> s[/.*/] >>> >> for example; >> �tpPrev, >> �tp � � � � : TTokenPrivileges; >> �token � � �: THandle; >> �dwRetLen � : DWord; >> begin >> ... >> how can I do it with your code? >> should I write new regexp for each function? > > No, you simply need to replace the outer match with a call to > String#scan. > > Cheers > > robert If I write this part of code it is seen OK for me, str.scan(/[^;]+;/) do |var| if /\A([^:]+):([^:]+);\z/ =~ var names = $1 type = $2.strip names.split(/,/).each do |name| printf "var: type: %-20s name: %-20s\n", type, name.strip end else puts "error with var #{var.inspect}" end end but > No, you simply need to replace the outer match with a call to > String#scan. what is the "replace the outer match" meaning? please explain a bit more. 7stud: I recognize it also. It is not working for me. I am using ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] thanks. -- Posted via http://www.ruby-forum.com/.