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

Slash cannot be specified in regex

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 1.0-JSR-3
    • 1.0-JSR-3
    • None
    • None
    • Solaris 8/Sun JVM 1.4.2_06

    Description

      Regular expression quoted with double quotes worked in groovy beta-10:
      Pattern p = Pattern.compile("\S");
      Matcher m1 = p.matcher("A");
      if (m1.matches()) {
      System.out.println(m1.group(0));
      }

      Fails is jsr-03:
      ... unexpected char: '\' @ ...

      // Works in GROOVY-JSR
      def m2 = "B" =~ /\S/;
      if (m2.matches()) {
      System.out.println(m2.group(0));
      }

      // Doesn't work in GROOVY-JSR-03 (unexpected char: "\")
      def m3 = "C" =~ "\S";
      if (m3.matches()) {
      System.out.println(m3.group(0));
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            kenquest Ken Quest
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: