jakarta-regexp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 16434] New: - underscore not matched
Date Sun, 26 Jan 2003 19:43:48 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16434>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16434

underscore not matched

           Summary: underscore not matched
           Product: Regexp
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Other
        AssignedTo: regexp-dev@jakarta.apache.org
        ReportedBy: issues.apache.org@mekenkamp.com


/* Example code is always best for reporting bugs. I could have made it a bit
 * more easy, but I'm tired (sorry). The Sun 1.4.0_01-b03 SDK I have run this
 * on seems to disagree with jakarta's regexp; I am inclined to believe Sun is
 * right...
 */

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.regexp.RE;

public class X {

    public final static String METHOD = "^[ \\t]*public[
\\t]+[_a-zA-Z][_a-zA-Z0-9\\.\\[\\]]*[ \\t]+([_a-zA-Z][\\w]*)[ \\t]*\\(";

    public final static String ok = "public void foo(";
    public final static String error = "public void _foo(";
    
    public static void main(String[] args) throws Exception {
        
        RE re = new RE(METHOD);

        System.out.println("sun: " + Pattern.matches(METHOD, ok) + ", apache: "
+ re.match(ok));
        System.out.println("sun: " + Pattern.matches(METHOD, error) + ", apache:
" + re.match(error));

    }
 
}

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


Mime
View raw message