Regex \n

Hi
short question:
I want to replace \n also:
gsub(/\na/sg,"A")
What is wrong ?
also "\n...." doesnt work!

Thx Berg

Hi
short question:
I want to replace \n also:
gsub(/\na/sg,"A")
What is wrong ?
also "\n...." doesnt work!

Thx Berg

···

On Thursday, July 14, 2016, A Berger <aberger7890@gmail.com> wrote:

Should work:

    irb(main):001:0> "foo\nbar\nbaz".gsub(/\n/, ' ')
    => "foo bar baz"

If it doesn't for you, could you please copy the exact string and code
you're using?

Hi
the problem was another: ruby -p

what is best to do that (with ruby -i ...) ?
Thx Berg

Are you running

    ruby -pi -e ...

? If yes, can you paste the entire command verbatim and say what'd you like
it todo? Unix shell or Wndows? (important for quoting rules and newline
conventions.)

···

On Thursday, 14 July 2016, A Berger <aberger7890@gmail.com> wrote:

Hi
the problem was another: ruby -p

what is best to do that (with ruby -i ...) ?
Thx Berg

--
Sent from Gmail Mobile