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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


/* 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:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to