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

java.util.regex.Pattern spec bugs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.4.0
    • core-libs
    • None
    • rc1
    • sparc
    • solaris_7

      Customer writes:

      The javadoc for java.util.regex.Pattern indicates that character class
      subtraction is done by a combination of intersection and negation:

      [a-z&&[^aeiou]]

      Then later in the same table, it indicates that named character classes
      can be subtracted with a hypen. The example give is:

       [\p{L}-[\p{Lu}]] Any letter except an uppercase letter
                          (subtraction)

      I suspect this is a syntax error, and my experiments with the
      implementation confirm it. I think the example should be written using
      && and ^ instead of -.

      The javadoc for Pattern says this:

          (?idmsux-idmsux:X) X, as a capturing group with the given flags on -
      off

      But the Perl documentation says this:

          (?imsx-imsx:pattern)
      This is for clustering, not capturing; it groups
      subexpressions like "()", but doesn't make
      backreferences as "()" does. So

      I suspect there is a typo in the javadoc, and it should say
      non-capturing instead of capturing.

            mmcclosksunw Michael Mccloskey (Inactive)
            mmcclosksunw Michael Mccloskey (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: