Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3697

Enhance consistency of regex/pattern DGM methods

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7-beta-1
    • 1.6.8, 1.7.1, 1.8-beta-1
    • None
    • None

    Description

      Most regex/pattern based DGM methods try to allow both, the regex as a String or as a Pattern.
      Here are the counter-examples:

      String
      String replaceFirst(Pattern pattern, String replacement)
      boolean matches(Pattern pattern)
      Object splitEachLine(String regex) {match -> ... }
      String replaceAll(String regex) {match -> ... }
      String replaceAll(Pattern pattern, String replacement)
      
      File
      Object splitEachLine(String sep) {match -> ... }
      
      Reader
      Object splitEachLine(String sep) {match -> ... }
      
      InputStream
      Object splitEachLine(String sep, String charset) {match -> ... } 
      
      Object splitEachLine(String sep) {match -> ... } 
      

      A special case is 'minus', which is particularly bad as you can provide a regex string but this
      will not be treated as a regex since that would conflict with String.minus(String).

      Attachments

        Activity

          People

            paulk Paul King
            codevise Dierk König
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: