logo       

[ruby-list:42414] 正規表現 [^/] がエラー???: msg#00068

lang.ruby.japanese

Subject: [ruby-list:42414] 正規表現 [^/] がエラー???

$ ruby -e 'puts "abc/def/ghi".sub(/\/[^/]+$/,"")'
-e:1: premature end of regular expression: /\/[^/
-e:1: syntax error
puts "abc/def/ghi".sub(/\/[^/]+$/,"")

これ何故でしょう。
ruby 1.8.4 (2005-12-24) [i686-linux]
ruby 1.8.1 (2003-12-25) [i686-linux]
で起きてます。

# basename dirname 相当の関数って無かったでしたっけ。。。

出沢@神奈川




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise