public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "john at austin dot homelinux dot net" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/15724] New: Inconsistancy between regex match in java.util.regexp between gcj and Sun's java.
Date: Sat, 29 May 2004 15:42:00 -0000	[thread overview]
Message-ID: <20040529153221.15724.john@austin.homelinux.net> (raw)

Playing around with the new java.util.regexp support I found that there is a 
pretty major difference in the pattern matching of String.matches(regexp) 
between gcj and Sun's java. 
 
It appears to me that on Sun's VM, you have to match the whole string from 
beginning to end, and on gcj, just a subset of the string. 
 
Actually I consider the way gcj is doing it to be "correct", but if you want 
consistancy with Sun's java, then it is not. 
 
Here's small program: 
 
import java.util.*; 
 
public class test { 
   
  public static void main(String[] args) { 
    String data="key=value"; 
     
    if (data.matches("^key=.*")) { 
      System.out.println("Match"); 
    } 
    else { 
      System.out.println("Doesn't match"); 
    } 
     
    if (data.matches("^key=")) { 
      System.out.println("Match"); 
    } 
    else { 
      System.out.println("Doesn't match"); 
    } 
  } 
 
 
The output on Sun's VM: 
Match 
Doesn't match 
 
The output when compiled in gcj: 
Match 
Match 
 
 
If you need the configuration info for my gcc: 
johnm:common]$ gcc -v 
Reading specs 
from /opt/gcc-3.5.0-20040528/lib/gcc/i686-pc-linux-gnu/3.5.0/specs 
Configured with: ../gcc-3.5.0-20040528/configure 
--prefix=/opt/gcc-3.5.0-20040528 --libexecdir=/opt/gcc-3.5.0-20040528/lib 
--enable-shared --enable-threads=posix --enable-__cxa_atexit 
--enable-clocale=gnu --enable-languages=c,c++,java 
Thread model: posix 
gcc version 3.5.0 20040528 (experimental)

-- 
           Summary: Inconsistancy between regex match in java.util.regexp
                    between gcj and Sun's java.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john at austin dot homelinux dot net
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15724


             reply	other threads:[~2004-05-29 15:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-29 15:42 john at austin dot homelinux dot net [this message]
2004-05-30 15:48 ` [Bug libgcj/15724] " pinskia at gcc dot gnu dot org
2005-07-26 21:44 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040529153221.15724.john@austin.homelinux.net \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).