Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8280101

in String.split grouped regex should keep the delimiter

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      In Perl split a grouped regex i.e. split(/(\.)/, $string) split the String while keeping the delimeter in the resulting array.
      split(/(,)/, "a,b,12,45,7:8") gives -> ["a", ",", "b", ",", "12", ",", "45",",","7:8"]
      This is possible in Java but with lookahead and lookbehind: (https://www.baeldung.com/java-split-string-keep-delimiters)



            rgiulietti Raffaello Giulietti
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: