<pustoi / spils.lv> schrieb im Newsbeitrag news:1104338672.146157.103190 / f14g2000cwb.googlegroups.com... > Hello, > > How can I cut out piece from path in ruby ? > For example I have path like that: > > path = /dir/dir/.../dir/content/dir/dir/.../dir/ > > ,where "dir" should be anything > > and I need to cut off all before content/dir/dir/.../dir/ > Thank you in advance ! 17:53:26 [temp]: ruby -e 'p "/dir/dir/.../dir/content/dir/dir/.../dir/".gsub(%r{^.*(/content)}, "\\1")' "/content/dir/dir/.../dir/" Note also: http://www.ruby-doc.org/core/classes/File.html#M000028 Regards robert