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 bu...@apache.org on 2003/01/26 20:43:48 UTC
DO NOT REPLY [Bug 16434] New: -
underscore not matched
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: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>