Dón*_*nal 1 java regex
我需要定义一个(Java)正则表达式,它将匹配任何不包含任何这些的字符串
Is it possible to express this as a single regex? I know it would be more readable to use 3 separate regexs, but I'd like to do it in one if possible.
Thanks, Don
Pau*_*and 6
请尝试以下方法:
final private static Pattern p = Pattern.compile(".*\\b(?:foos?|bars?|bazs?)\\b.*"); public boolean isGoodString(String stringToTest) { return !p.matcher(stringToTest).matches(); }
归档时间:
16 年 前
查看次数:
171 次
最近记录: