gnu-regexp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Regexp] Problem with regexp


From: Peter Hanusiak
Subject: [Regexp] Problem with regexp
Date: Fri, 1 Nov 2002 03:21:26 +0100
User-agent: Mutt/1.3.25i

Hi,

I find, maybe a bug in regexp. I'm sending an example code.
If I'm doing something wrong please explain me it.
It shows me:
Exception in thread "main" java.lang.OutOfMemoryError
        <<no stack trace available>>

I'm using latest regexp with Sun's java version "1.3.1_01"

Thanks
Peter

example code:

package parser;
import gnu.regexp.*;

public class SQLSemicolonParser {
  private SQLSemicolonParser() { }

        public static void main(String[] argv) {
                try {
                        String[] test = parse("DDweweddddddddddfff;");
                for (int i = 0; i<test.length ; i++)
                        System.out.println(test[i]);                    
                }
                catch ( Exception e) {
                }

        }


        public static String[] parse(String text) throws REException {

    // Construct the regular expression

    RE expression = new 
RE("([^\\\"\\'\\;]+|\\\"[^\\\"]*\\\"|\\'[^\\']*\\')*\\;?");

    REMatch[] matches = expression.getAllMatches(text);
                String[] result = new String[matches.length];
    for (int i = 0; i < matches.length; i++)
                        result[i] = matches[i].toString();
                return result;

  }
}

-- 
Peter "Hanus" Hanusiak
E-mail: address@hidden
HomePage: http://www.hanusiak.sk
Phone: +421905504772




reply via email to

[Prev in Thread] Current Thread [Next in Thread]