Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
exp("^[a[k][t][l]]{6}$"); exp("^(bEt).*(oc)$"); exp("^(bEt)$"); exp("^(a).*"); exp("bEt(oc)*"); exp("^(bEt).*");
exp("[baba[bebe][bibi][bobo][bubu][fafa][fefe][fofo][fufu]");
我想知道如何从txt 文件。我已经搜索了answears,但找不到它们。在我看来,最后一行将是解决方案,但它不是
[]创建一个字符类,|是or操作符。尝试
[]
|
or
exp("baba|bebe|bibi|bobo|bubu|fafa|fefe|fofo|fufu");
这也可以缩短,另一种写法是
exp("bibi|([bf][aeou])\\1");
我强烈建议您浏览 Java 教程的完整正则表达式部分。