From: iMelody Ooo Date: 2010-09-18T23:23:33+09:00 Subject: Ruby regexpresion, error? :-( I want to match last chars of the line, def show_regexp(a,re) if a =~ re "#{$`}<<#{$&}>>#{$'}" else "no match" end end puts show_regexp("abc as;",/^a/) puts show_regexp("abc as;",/as$/) puts show_regexp("abc as;",/\zas/) puts show_regexp("abc as;",/\Zas/) puts show_regexp("abc as;",/(.*)as$/) puts show_regexp("abc as;",/(.*)\zas/) puts show_regexp("abc as;",/(.*)\Zas/) Result: <>bc as; no match no match no match no match no match no match -- Posted via http://www.ruby-forum.com/.