jakarta-regexp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: jakarta-regexp/src/java/org/apache/regexp RE.java RETest.java
Date Fri, 30 Jan 2004 14:47:04 GMT
vgritsenko    2004/01/30 06:47:04

  Modified:    src/java/org/apache/regexp RE.java RETest.java
  Log:
  Patch for OP_ANY in MULTILINE mode (bug #4137). Thanks to Hendrik Brummermann
  
  Revision  Changes    Path
  1.16      +5 -6      jakarta-regexp/src/java/org/apache/regexp/RE.java
  
  Index: RE.java
  ===================================================================
  RCS file: /home/cvs/jakarta-regexp/src/java/org/apache/regexp/RE.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- RE.java	30 Jan 2004 14:36:21 -0000	1.15
  +++ RE.java	30 Jan 2004 14:47:04 -0000	1.16
  @@ -1069,7 +1069,7 @@
                           if ((matchFlags & MATCH_MULTILINE) == MATCH_MULTILINE)
                           {
                               // Give up if we're not at the end of a line
  -                            if (! isNewline(idx)) {
  +                            if (!isNewline(idx)) {
                                   return -1;
                               } else {
                                   break;
  @@ -1156,18 +1156,17 @@
                           {
                               return -1;
                           }
  -                        idx++;
  -                        break;
                       }
                       else
                       {
                           // Match anything but a newline
  -                        if (search.isEnd(idx) || search.charAt(idx++) == '\n')
  +                        if (search.isEnd(idx) || isNewline(idx))
                           {
                               return -1;
                           }
  -                        break;
                       }
  +                    idx++;
  +                    break;
   
                   case OP_ATOM:
                       {
  
  
  
  1.10      +22 -1     jakarta-regexp/src/java/org/apache/regexp/RETest.java
  
  Index: RETest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-regexp/src/java/org/apache/regexp/RETest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RETest.java	30 Jan 2004 14:36:21 -0000	1.9
  +++ RETest.java	30 Jan 2004 14:47:04 -0000	1.10
  @@ -432,6 +432,27 @@
           if (!r.match("\u2029abc")) {
               fail("\"\\u2029abc\" doesn't match \"^abc$\"");
           }
  +
  +        // Test MATCH_MULTILINE. Test that '.' does not mathces new line.
  +        r = new RE("^a.*b$", RE.MATCH_MULTILINE);
  +        if (r.match("a\nb")) {
  +            fail("\"a\\nb\" matches \"^a.*b$\"");
  +        }
  +        if (r.match("a\rb")) {
  +            fail("\"a\\rb\" matches \"^a.*b$\"");
  +        }
  +        if (r.match("a\r\nb")) {
  +            fail("\"a\\r\\nb\" matches \"^a.*b$\"");
  +        }
  +        if (r.match("a\u0085b")) {
  +            fail("\"a\\u0085b\" matches \"^a.*b$\"");
  +        }
  +        if (r.match("a\u2028b")) {
  +            fail("\"a\\u2028b\" matches \"^a.*b$\"");
  +        }
  +        if (r.match("a\u2029b")) {
  +            fail("\"a\\u2029b\" matches \"^a.*b$\"");
  +        }
       }
   
       private void testPrecompiledRE()
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org


Mime
View raw message