Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39944

String::replaceAll method in groovy script works not as described in man.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • pipeline
    • None

      ...
      def testString = "Multi line"
      def testStringReplaced = ( testString.replaceAll(~/(line)/,

      { it[0] + it[0] }

      ) )
      echo testStringReplaced
      ...

      This block produces output: lineline
      I expect it to produce: Multi lineline

            Unassigned Unassigned
            fomenko Vladimir Fomenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: