JAVA使用正则表达式 性能问题
2010-10-11 10:15
351 查看
JAVA使用正则表达式必须预编译,建议使用oro库
private static String regex = "^[a-zA-Z][a-zA-Z0-9_]{0,50}$";
private static Pattern pattern = new Perl5Compiler().compile(regex, Perl5Compiler.READ_ONLY_MASK
| Perl5Compiler.SINGLELINE_MASK);
在方法里使用
new Perl5Matcher().matches(callback, pattern);
否则正则表达式容易导致JVA崩溃
private static String regex = "^[a-zA-Z][a-zA-Z0-9_]{0,50}$";
private static Pattern pattern = new Perl5Compiler().compile(regex, Perl5Compiler.READ_ONLY_MASK
| Perl5Compiler.SINGLELINE_MASK);
在方法里使用
new Perl5Matcher().matches(callback, pattern);
否则正则表达式容易导致JVA崩溃
相关文章推荐
- JAVA中正则表达式的使用-由一个简单问题引出的知识
- java中split(regex)使用中要注意的问题:正则表达式
- java中split(regex)使用中要注意的问题:正则表达式
- java中split(regex)使用中要注意的问题:正则表达式
- Java正则表达式 重复字符(串)问题
- java正则表达式的使用1 通过正则表达式抓取网页中的email
- java中关于正则表达式反斜杠问题http:\....
- java中正则表达式使用
- java 使用正则表达式过滤HTML中标签
- 提高你的Java代码质量吧:多使用异常,把性能问题放一边
- Java中正则表达式使用方法详解
- 提高你的Java代码质量吧:推荐在复杂字符串操作中使用正则表达式
- Java的正则表达式使用及案例
- Java中正则表达式的简单使用
- 黑马程序员_java_08_java使用正则表达式
- Java 正则表达式的使用
- java中正则表达式的使用
- 在JAVA中使用正则表达式
- java中正则表达式的理解和使用
- Java_正则表达式_推荐在复杂字符串操作中使用正则表达式