Forum: Ruby instead of re.sub

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
cihan (Guest)
on 2007-06-16 15:09
hi I want to remove all \n parts of a .txt file but I can't find the
command.

If I use .sub the code makes the only first replacement but I need it to
check all of the file.

In python language they use re but in ruby what should I do? please give
me a way.
Stefano C. (Guest)
on 2007-06-16 15:24
(Received via mailing list)
Alle sabato 16 giugno 2007, cihan ha scritto:
> hi I want to remove all \n parts of a .txt file but I can't find the
> command.
>
> If I use .sub the code makes the only first replacement but I need it to
> check all of the file.
>
> In python language they use re but in ruby what should I do? please give
> me a way.

Use gsub instead of sub.

Stefano
This topic is locked and can not be replied to.