0

I have the following regex to replace successive end lines with nothing:

Example :

enter image description here

line.replaceAll("\\R+$","");

this is my java code:

public static void main(String[] args) {
        String line = "si vous me permettez de parler une seconde";
        line.replaceAll("\\R+$", "");
        System.out.println(line);
    }

That's work well, but I need to develop it in groovy:

public static void main(String[] args) {
        String line = "si vous me permettez de parler une seconde";
        line.replaceAll("\\R+\$", "");
        System.out.println(line);
    }

But the groovy regex doesn't replace the end lines with nothing, so at the end I get the same String.

I didn't understand why, any ideas?

Yacino
  • 645
  • 2
  • 10
  • 32

0 Answers0