You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-dev@jakarta.apache.org by vg...@apache.org on 2003/05/02 03:03:47 UTC

cvs commit: jakarta-regexp/xdocs RETest.txt changes.xml

vgritsenko    2003/05/01 18:03:47

  Modified:    src/java/org/apache/regexp RE.java RECompiler.java
                        REProgram.java RETest.java
               xdocs    RETest.txt changes.xml
  Log:
  Fix bugs #306, #3879, #10893, #1030, #4057, #14954, #5212. See also bug #19329.
  Year is 2003.
  
  Revision  Changes    Path
  1.12      +21 -19    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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- RE.java	13 Dec 2002 18:11:57 -0000	1.11
  +++ RE.java	2 May 2003 01:03:47 -0000	1.12
  @@ -5,7 +5,7 @@
    * 
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -57,6 +57,7 @@
    *
    */ 
    
  +import java.io.Serializable;
   import java.util.Vector;
   
   /**
  @@ -365,7 +366,7 @@
    * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
    * @version $Id$
    */
  -public class RE
  +public class RE implements Serializable
   {
       /**
        * Specifies normal, case-sensitive matching behaviour.
  @@ -465,25 +466,24 @@
   
       // State of current program
       REProgram program;                            // Compiled regular expression 'program'
  -    CharacterIterator search;                                // The string being matched against
  -    int idx;                                      // Current index in string being searched
  +    transient CharacterIterator search;           // The string being matched against
       int matchFlags;                               // Match behaviour flags
       int maxParen = MAX_PAREN;
   
       // Parenthesized subexpressions
  -    int parenCount;                               // Number of subexpressions matched (num open parens + 1)
  -    int start0;                                   // Cache of start[0]
  -    int end0;                                     // Cache of start[0]
  -    int start1;                                   // Cache of start[1]
  -    int end1;                                     // Cache of start[1]
  -    int start2;                                   // Cache of start[2]
  -    int end2;                                     // Cache of start[2]
  -    int[] startn;                                 // Lazy-alloced array of sub-expression starts
  -    int[] endn;                                   // Lazy-alloced array of sub-expression ends
  +    transient int parenCount;                     // Number of subexpressions matched (num open parens + 1)
  +    transient int start0;                         // Cache of start[0]
  +    transient int end0;                           // Cache of start[0]
  +    transient int start1;                         // Cache of start[1]
  +    transient int end1;                           // Cache of start[1]
  +    transient int start2;                         // Cache of start[2]
  +    transient int end2;                           // Cache of start[2]
  +    transient int[] startn;                       // Lazy-alloced array of sub-expression starts
  +    transient int[] endn;                         // Lazy-alloced array of sub-expression ends
   
       // Backreferences
  -    int[] startBackref;                           // Lazy-alloced array of backref starts
  -    int[] endBackref;                             // Lazy-alloced array of backref ends
  +    transient int[] startBackref;                 // Lazy-alloced array of backref starts
  +    transient int[] endBackref;                   // Lazy-alloced array of backref ends
   
       /**
        * Constructs a regular expression matcher from a String by compiling it
  @@ -1098,12 +1098,14 @@
                                   return -1;
                               }
   
  +                            char c = search.charAt(idx);
  +
                               // Switch on escape
                               switch (opdata)
                               {
                                   case E_ALNUM:
                                   case E_NALNUM:
  -                                    if (!(Character.isLetterOrDigit(search.charAt(idx)) == (opdata == E_ALNUM)))
  +                                    if (!((Character.isLetterOrDigit(c) || c == '_') == (opdata == E_ALNUM)))
                                       {
                                           return -1;
                                       }
  @@ -1111,7 +1113,7 @@
   
                                   case E_DIGIT:
                                   case E_NDIGIT:
  -                                    if (!(Character.isDigit(search.charAt(idx)) == (opdata == E_DIGIT)))
  +                                    if (!(Character.isDigit(c) == (opdata == E_DIGIT)))
                                       {
                                           return -1;
                                       }
  @@ -1119,7 +1121,7 @@
   
                                   case E_SPACE:
                                   case E_NSPACE:
  -                                    if (!(Character.isWhitespace(search.charAt(idx)) == (opdata == E_SPACE)))
  +                                    if (!(Character.isWhitespace(c) == (opdata == E_SPACE)))
                                       {
                                           return -1;
                                       }
  
  
  
  1.9       +66 -62    jakarta-regexp/src/java/org/apache/regexp/RECompiler.java
  
  Index: RECompiler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-regexp/src/java/org/apache/regexp/RECompiler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RECompiler.java	13 Dec 2002 18:40:16 -0000	1.8
  +++ RECompiler.java	2 May 2003 01:03:47 -0000	1.9
  @@ -2,10 +2,10 @@
   
   /*
    * ====================================================================
  - * 
  + *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -13,7 +13,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    notice, this list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
  @@ -21,15 +21,15 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:  
  - *       "This product includes software developed by the 
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowlegement may appear in the software itself,
    *    if and wherever such third-party acknowlegements normally appear.
    *
    * 4. The names "The Jakarta Project", "Jakarta-Regexp", and "Apache Software
    *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written 
  + *    from this software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache"
  @@ -55,7 +55,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - */ 
  + */
   
   import org.apache.regexp.RE;
   import java.util.Hashtable;
  @@ -100,7 +100,6 @@
       // {m,n} stacks
       static final int maxBrackets = 10;                  // Maximum number of bracket pairs
       static final int bracketUnbounded = -1;             // Unbounded value
  -    static final int bracketFinished = -2;              // Unbounded value
       int brackets = 0;                                   // Number of bracket sets
       int[] bracketStart = null;                          // Starting point
       int[] bracketEnd = null;                            // Ending point
  @@ -373,17 +372,13 @@
           try
           {
               bracketOpt[brackets] = Integer.parseInt(number.toString()) - bracketMin[brackets];
  -            if (bracketMin[brackets] < 1)
  -            {
  -                bracketOpt[brackets]--;
  -            }
           }
           catch (NumberFormatException e)
           {
               syntaxError("Expected valid number");
           }
   
  -        // Optional repetitions must be > 0
  +        // Optional repetitions must be >= 0
           if (bracketOpt[brackets] < 0)
           {
               syntaxError("Bad range");
  @@ -461,7 +456,7 @@
                               c = Character.toLowerCase(c);
                               if (c >= 'a' && c <= 'f')
                               {
  -                                // Compute new value 
  +                                // Compute new value
                                   val = (val << 4) + (c - 'a') + 10;
                               }
                               else
  @@ -555,7 +550,7 @@
               {
                   idx++;
               }
  -            
  +
               // Should be a ":]" to terminate the POSIX character class
               if ((idx + 1) < len && pattern.charAt(idx) == ':' && pattern.charAt(idx + 1) == ']')
               {
  @@ -714,7 +709,7 @@
               else
               {
                   // If simple character and not start of range, include it
  -                if ((idx + 1) >= len || pattern.charAt(idx + 1) != '-')
  +                if (idx >= len || pattern.charAt(idx) != '-')
                   {
                       range.include(simpleChar, include);
                   }
  @@ -1025,7 +1020,7 @@
                               break;
                           }
                       }
  -                    
  +
                       // If its not in the list we parse the {m,n}
                       if (!found)
                       {
  @@ -1038,17 +1033,22 @@
                           bracketEnd[brackets] = idx;
                           i = brackets++;
                       }
  -                    
  -                    // If there's a min, rewind stream and reparse
  -                    if (--bracketMin[i] > 0)
  +
  +                    // Process min first
  +                    if (bracketMin[i]-- > 0)
                       {
  -                        // Rewind stream and run it through again
  -                        idx = idxBeforeTerminal;
  +                        if (bracketMin[i] > 0 || bracketOpt[i] != 0) {
  +                            // Rewind stream and run it through again - more matchers coming
  +                            idx = idxBeforeTerminal;
  +                        } else {
  +                            // Bug #1030: No optinal matches - no need to rewind
  +                            idx = bracketEnd[i];
  +                        }
                           break;
                       }
  -                    
  +
                       // Do the right thing for maximum ({m,})
  -                    if (bracketOpt[i] == bracketFinished)
  +                    if (bracketOpt[i] == bracketUnbounded)
                       {
                           // Drop through now and closure expression.
                           // We are done with the {m,} expr, so skip rest
  @@ -1057,37 +1057,41 @@
                           idx = bracketEnd[i];
                       }
                       else
  -                        if (bracketOpt[i] == bracketUnbounded)
  +                        if (bracketOpt[i]-- > 0)
                           {
  -                            idx = idxBeforeTerminal;
  -                            bracketOpt[i] = bracketFinished;
  -                            break;
  -                        }
  -                        else
  -                            if (bracketOpt[i]-- > 0)
  +                            if (bracketOpt[i] > 0)
                               {
  -                                // Drop through to optionally close and then 'play it again sam!'
  +                                // More optional matchers - 'play it again sam!'
                                   idx = idxBeforeTerminal;
  -                                closureType = '?';
  -                            }
  -                            else
  -                            {
  -                                // We are done. skip the rest of {m,n} expr
  +                            } else {
  +                                // Bug #1030: We are done - this one is last and optional
                                   idx = bracketEnd[i];
  -                                break;
                               }
  +                            // Drop through to optionally close
  +                            closureType = '?';
  +                        }
  +                        else
  +                        {
  +                            // Rollback terminal - neither min nor opt matchers present
  +                            lenInstruction = ret;
  +                            node(RE.OP_NOTHING, 0);
  +
  +                            // We are done. skip the rest of {m,n} expr
  +                            idx = bracketEnd[i];
  +                            break;
  +                        }
                   }
  -                
  +
                   // Fall through!
  -                
  +
                   case '?':
                   case '*':
  -                    
  +
                       if (!greedy)
                       {
                           break;
                       }
  -                    
  +
                       if (closureType == '?')
                       {
                           // X? is compiled as (X|)
  @@ -1097,7 +1101,7 @@
                           setNextOfEnd(ret, nothing);                       // point (second) branch to OP_NOTHING
                           setNextOfEnd(ret + RE.nodeSize, nothing);         // point the end of X to OP_NOTHING node
                       }
  -                    
  +
                       if (closureType == '*')
                       {
                           // X* is compiled as (X{gotoX}|)
  @@ -1109,7 +1113,7 @@
                           setNextOfEnd(ret, node(RE.OP_NOTHING, 0));                // OP_NOTHING
                       }
                       break;
  -                    
  +
                   case '+':
                   {
                       // X+ is compiled as X({gotoX}|)
  @@ -1134,8 +1138,8 @@
                   case '?':
                       nodeInsert(RE.OP_RELUCTANTMAYBE, 0, ret);
                       break;
  -                    
  -                case '*':       
  +
  +                case '*':
                       nodeInsert(RE.OP_RELUCTANTSTAR, 0, ret);
                       break;
   
  @@ -1145,7 +1149,7 @@
               }
   
               // Point to the expr after the closure
  -            setNextOfEnd(ret, lenInstruction);          
  +            setNextOfEnd(ret, lenInstruction);
           }
           return ret;
       }
  @@ -1347,7 +1351,7 @@
           int[] minRange = new int[size];     // Range minima
           int[] maxRange = new int[size];     // Range maxima
           int num = 0;                        // Number of range array elements in use
  -        
  +
           /**
            * Deletes the range at a given index from the range lists
            * @param index Index of range to delete from minRange and maxRange arrays.
  @@ -1359,7 +1363,7 @@
               {
                   return;
               }
  -            
  +
               // Move elements down
               while (index++ < num)
               {
  @@ -1369,11 +1373,11 @@
                       maxRange[index-1] = maxRange[index];
                   }
               }
  -            
  +
               // One less element now
               num--;
           }
  -        
  +
           /**
            * Merges a range into the range list, coalescing ranges if possible.
            * @param min Minimum end of range
  @@ -1389,7 +1393,7 @@
                   {
                       return;
                   }
  -                
  +
                   // Min-max subsumes minRange[i]-maxRange[i]
                   else if (min <= minRange[i] && max >= maxRange[i])
                   {
  @@ -1397,7 +1401,7 @@
                       merge(min, max);
                       return;
                   }
  -                
  +
                   // Min is in the range, but max is outside
                   else if (min >= minRange[i] && min <= maxRange[i])
                   {
  @@ -1406,7 +1410,7 @@
                       merge(min, max);
                       return;
                   }
  -                
  +
                   // Max is in the range, but min is outside
                   else if (max >= minRange[i] && max <= maxRange[i])
                   {
  @@ -1416,7 +1420,7 @@
                       return;
                   }
               }
  -            
  +
               // Must not overlap any other ranges
               if (num >= size)
               {
  @@ -1432,7 +1436,7 @@
               maxRange[num] = max;
               num++;
           }
  -        
  +
           /**
            * Removes a range by deleting or shrinking all other ranges
            * @param min Minimum end of range
  @@ -1450,7 +1454,7 @@
                       i--;
                       return;
                   }
  -                
  +
                   // min-max is subsumed by minRange[i]-maxRange[i]
                   else if (min >= minRange[i] && max <= maxRange[i])
                   {
  @@ -1467,14 +1471,14 @@
                       }
                       return;
                   }
  -                
  +
                   // minRange is in the range, but maxRange is outside
                   else if (minRange[i] >= min && minRange[i] <= max)
                   {
                       minRange[i] = max + 1;
                       return;
                   }
  -                
  +
                   // maxRange is in the range, but minRange is outside
                   else if (maxRange[i] >= min && maxRange[i] <= max)
                   {
  @@ -1483,7 +1487,7 @@
                   }
               }
           }
  -        
  +
           /**
            * Includes (or excludes) the range from min to max, inclusive.
            * @param min Minimum end of range
  @@ -1501,7 +1505,7 @@
                   remove(min, max);
               }
           }
  -        
  +
           /**
            * Includes a range with the same min and max
            * @param minmax Minimum and maximum end of range (inclusive)
  
  
  
  1.3       +4 -5      jakarta-regexp/src/java/org/apache/regexp/REProgram.java
  
  Index: REProgram.java
  ===================================================================
  RCS file: /home/cvs/jakarta-regexp/src/java/org/apache/regexp/REProgram.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- REProgram.java	3 Dec 2002 20:57:52 -0000	1.2
  +++ REProgram.java	2 May 2003 01:03:47 -0000	1.3
  @@ -5,7 +5,7 @@
    * 
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -57,8 +57,7 @@
    *
    */ 
   
  -import org.apache.regexp.RE;
  -import java.util.Hashtable;
  +import java.io.Serializable;
   
   /**
    * A class that holds compiled regular expressions.  This is exposed mainly
  @@ -72,7 +71,7 @@
    * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
    * @version $Id$
    */
  -public class REProgram
  +public class REProgram implements Serializable
   {
       static final int OPT_HASBACKREFS = 1;
   
  
  
  
  1.5       +89 -20    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RETest.java	27 Feb 2001 08:37:06 -0000	1.4
  +++ RETest.java	2 May 2003 01:03:47 -0000	1.5
  @@ -2,10 +2,10 @@
   
   /*
    * ====================================================================
  - * 
  + *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -13,7 +13,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    notice, this list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
  @@ -22,14 +22,14 @@
    *
    * 3. The end-user documentation included with the redistribution, if
    *    any, must include the following acknowlegement:
  - *       "This product includes software developed by the 
  + *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowlegement may appear in the software itself,
    *    if and wherever such third-party acknowlegements normally appear.
    *
    * 4. The names "The Jakarta Project", "Jakarta-Regexp", and "Apache Software
    *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written 
  + *    from this software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache"
  @@ -62,6 +62,10 @@
   import java.io.InputStreamReader;
   import java.io.PrintWriter;
   import java.io.File;
  +import java.io.ByteArrayOutputStream;
  +import java.io.ObjectOutputStream;
  +import java.io.ByteArrayInputStream;
  +import java.io.ObjectInputStream;
   
   /**
    * Data driven (and optionally interactive) testing harness to exercise regular
  @@ -83,13 +87,13 @@
       // Construct a matcher and a debug compiler
       RE r = new RE();
       REDebugCompiler compiler = new REDebugCompiler();
  -    
  +
       /**
        * Main program entrypoint.  If an argument is given, it will be compiled
        * and interactive matching will ensue.  If no argument is given, the
        * file RETest.txt will be used as automated testing input.
  -     * @param arg Command line arguments (optional regular expression)
  -    */
  +     * @param args Command line arguments (optional regular expression)
  +     */
       public static void main(String[] args)
       {
           try
  @@ -104,9 +108,9 @@
   
       /**
        * Testing entrypoint.
  -     * @param arg Command line arguments
  +     * @param args Command line arguments
        * @exception Exception thrown in case of error
  -    */
  +     */
       public static boolean test( String[] args ) throws Exception
       {
           RETest test = new RETest();
  @@ -132,7 +136,7 @@
   
       /**
        * Constructor
  -    */
  +     */
       public RETest()
       {
       }
  @@ -140,7 +144,7 @@
       /**
        * Compile and test matching against a single expression
        * @param expr Expression to compile and test
  -    */
  +     */
       void runInteractiveTests(String expr)
       {
           try
  @@ -198,7 +202,7 @@
       /**
        * Exit with a fatal error.
        * @param s Last famous words before exiting
  -    */
  +     */
       void die(String s)
       {
           say("FATAL ERROR: " + s);
  @@ -230,7 +234,7 @@
       /**
        * Show a success
        * @param s Success story
  -    */
  +     */
       void success(String s)
       {
           if (showSuccesses)
  @@ -243,7 +247,7 @@
       /**
        * Say something to standard out
        * @param s What to say
  -    */
  +     */
       void say(String s)
       {
           System.out.println (s);
  @@ -251,7 +255,7 @@
   
       /**
        * Show an expression
  -    */
  +     */
       void show()
       {
           say("" + NEW_LINE + "-----------------------" + NEW_LINE + "");
  @@ -261,7 +265,7 @@
       /**
        * Dump parenthesized subexpressions found by a regular expression matcher object
        * @param r Matcher object with results to show
  -    */
  +     */
       void showParens(RE r)
       {
           // Loop through each paren
  @@ -297,8 +301,8 @@
   
       /**
        * Run automated tests in RETest.txt file (from Perl 4.0 test battery)
  -    * @exception Exception thrown in case of error
  -    */
  +     * @exception Exception thrown in case of error
  +     */
       void runAutomatedTests(String testDocument) throws Exception
       {
           long ms = System.currentTimeMillis();
  @@ -328,6 +332,9 @@
           String s1 = r.subst("aaaabfooaaabgarplyaaabwackyb", "-");
           System.out.println ("s = " + s1);
   
  +        // Some unit tests
  +        runAutomatedTests();
  +
           // Test from script file
           File testInput = new File(testDocument);
           if (! testInput.exists())
  @@ -458,6 +465,10 @@
                                   say("   Paren " + p + " : " + r.getParen(p));
   
                                   // Compare expected result with actual
  +                                if (register.length() == 0 && r.getParen(p) == null)
  +                                {
  +                                    // Consider "" in test file equal to null
  +                                } else
                                   if (!register.equals(r.getParen(p)))
                                   {
                                       // Register isn't what it was supposed to be
  @@ -521,5 +532,63 @@
   
           // Print final results
           System.out.println( NEW_LINE + "Tests complete.  " + n + " tests, " + failures + " failure(s).");
  +    }
  +
  +    /**
  +     * Run automated unit test
  +     * @exception Exception thrown in case of error
  +     */
  +    void runAutomatedTests() throws Exception
  +    {
  +        // Serialization test 1: Compile regexp and serialize/deserialize it
  +        RE r = new RE("(a*)b");
  +        say("Serialized/deserialized (a*)b");
  +        ByteArrayOutputStream out = new ByteArrayOutputStream(128);
  +        new ObjectOutputStream(out).writeObject(r);
  +        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
  +        r = (RE)new ObjectInputStream(in).readObject();
  +        if (!r.match("aaab")) {
  +            fail("Did not match 'aaab' with deserialized RE.");
  +        }
  +        say("aaaab = true");
  +        showParens(r);
  +
  +        // Serialization test 2: serialize/deserialize used regexp
  +        out.reset();
  +        say("Deserialized (a*)b");
  +        new ObjectOutputStream(out).writeObject(r);
  +        in = new ByteArrayInputStream(out.toByteArray());
  +        r = (RE)new ObjectInputStream(in).readObject();
  +        if (r.getParenCount() != 0) {
  +            fail("Has parens after deserialization.");
  +        }
  +        if (!r.match("aaab")) {
  +            fail("Did not match 'aaab' with deserialized RE.");
  +        }
  +        say("aaaab = true");
  +        showParens(r);
  +
  +        // Test MATCH_CASEINDEPENDENT
  +        r = new RE("abc(\\w*)");
  +        say("MATCH_CASEINDEPENDENT abc(\\w*)");
  +        r.setMatchFlags(RE.MATCH_CASEINDEPENDENT);
  +        say("abc(d*)");
  +        if (!r.match("abcddd")) {
  +            fail("Did not match 'abcddd'.");
  +        }
  +        say("abcddd = true");
  +        showParens(r);
  +
  +        if (!r.match("aBcDDdd")) {
  +            fail("Did not match 'aBcDDdd'.");
  +        }
  +        say("aBcDDdd = true");
  +        showParens(r);
  +
  +        if (!r.match("ABCDDDDD")) {
  +            fail("Did not match 'ABCDDDDD'.");
  +        }
  +        say("ABCDDDDD = true");
  +        showParens(r);
       }
   }
  
  
  
  1.7       +213 -1    jakarta-regexp/xdocs/RETest.txt
  
  Index: RETest.txt
  ===================================================================
  RCS file: /home/cvs/jakarta-regexp/xdocs/RETest.txt,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RETest.txt	13 Dec 2002 18:40:16 -0000	1.6
  +++ RETest.txt	2 May 2003 01:03:47 -0000	1.7
  @@ -1066,4 +1066,216 @@
   [a-z]{0,3}
   123abcdefg123
   YES
  -abc
  +
  +#175
  +ab{0,1}a
  +aa
  +YES
  +aa
  +
  +#176
  +ab{0,1}a
  +aba
  +YES
  +aba
  +
  +#177
  +ab{0,1}a
  +abba
  +NO
  +
  +#178
  +ab{0,2}a
  +aa
  +YES
  +aa
  +
  +#179
  +ab{0,2}a
  +aba
  +YES
  +aba
  +
  +#180
  +ab{0,2}a
  +abba
  +YES
  +abba
  +
  +#181
  +ab{0,2}a
  +abbba
  +NO
  +
  +#182
  +ab{1,1}a
  +aa
  +NO
  +
  +#183
  +ab{1,1}a
  +aba
  +YES
  +aba
  +
  +#184
  +ab{1,1}a
  +abba
  +NO
  +
  +#185
  +ab{1,2}a
  +aa
  +NO
  +
  +#186
  +ab{1,2}a
  +aba
  +YES
  +aba
  +
  +#187
  +ab{1,2}a
  +abba
  +YES
  +abba
  +
  +#188
  +ab{1,2}a
  +abbba
  +NO
  +
  +#189
  +ab{0,}a
  +aa
  +YES
  +aa
  +
  +#190
  +ab{0,}a
  +aba
  +YES
  +aba
  +
  +#191
  +ab{0,}a
  +abba
  +YES
  +abba
  +
  +#192
  +ab{1,}a
  +aa
  +NO
  +
  +#193
  +ab{1,}a
  +aba
  +YES
  +aba
  +
  +#194
  +ab{1,}a
  +abba
  +YES
  +abba
  +
  +#195
  +ab{1}a
  +aa
  +NO
  +
  +#196
  +ab{1}a
  +aba
  +YES
  +aba
  +
  +#197
  +ab{1}a
  +abba
  +NO
  +
  +#198
  +ab{0}a
  +aa
  +YES
  +aa
  +
  +#199
  +ab{0}a
  +aba
  +NO
  +
  +#200
  +ab{2}a
  +aa
  +NO
  +
  +#201
  +ab{2}a
  +aba
  +NO
  +
  +#202
  +ab{2}a
  +abba
  +YES
  +abba
  +
  +#203
  +ab{2}a
  +abbba
  +NO
  +
  +#204
  +[ \-]
  + -
  +YES
  + -
  +
  +#205
  +[a-z0-9\.\-]+
  +{regexp-1.2}
  +YES
  +regexp-1.2
  +
  +#206
  +[a-z0-9\-\.]+
  +{regexp-1.2}
  +YES
  +regexp-1.2
  +
  +#207
  +[a-z\-0-9\.]+
  +{regexp-1.2}
  +YES
  +regexp-1.2
  +
  +#208
  +\w+
  +a_b
  +YES
  +a_b
  +
  +#209
  +([0123])??((((1st)|(2nd))|(3rd))|(\dth))
  +1st
  +YES
  +1st
  +
  +1st
  +1st
  +1st
  +1st
  +
  +#210
  +[^\s\]'<>(),;:\.\[]
  +-
  +YES
  +-
  +
  +#211
  +^\(?(\d{3})\)?[\- ]?(\d{3})[\- ]?(\d{4})$
  +(425) 576+1202
  +NO
  
  
  
  1.8       +21 -0     jakarta-regexp/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-regexp/xdocs/changes.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- changes.xml	13 Dec 2002 18:40:55 -0000	1.7
  +++ changes.xml	2 May 2003 01:03:47 -0000	1.8
  @@ -3,6 +3,7 @@
   
     <properties>
       <author email="jon@latchkey.com">Jon S. Stevens</author>
  +    <author email="vgritsenko@apache.org">Vadim Gritsenko</author>
       <title>Regexp Changes</title>
     </properties>
   
  @@ -17,6 +18,26 @@
   
   <h3>Version 1.3-dev</h3>
   <ul>
  +<li>Fixed Bug 
  +    <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5212">5212</a>, aka
  +    <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14954">14954</a>:
  +    A bug caused by '-' in character class definition ('[...]') (VG)</li>
  +<li>Fixed Bug 
  +    <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4057">4057</a>:
  +    \w does not match underscore (VG)</li>
  +<li>Fixed Bug 
  +    <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1030">1030</a>, aka
  +    <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10893">10893</a>:
  +    {n.m} notation work incorrect if n=0 (VG)</li>
  +<li>Re-visited Bug
  +    <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3879">3879</a>:
  +    Expressions using {0,n} match 0 to n+1 times instead of 0 to n times.
  +    Now, expression "[a-z]{0,3}" matches "123abcdefg123" resulting in ""
  +    (empty string). (VG)</li>
  +<li>Fixed Bug 
  +    <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=306">306</a>:
  +    Why is the RE class not Serializable? (VG)</li>
  +
   <li>Applied patches for Bug 
       <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3879">3879</a>. (JSS)</li>
   <li>Applied patches for Bug 
  
  
  

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