package p1;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Login
{
public static void main ( String[] args )
{
String reg = "(?i)\\]*\\>";
String str = "java中,正则表达式怎么写匹配或者
两种样式";
Pattern pattern = Pattern.compile (reg);
Matcher matcher = pattern.matcher (str);
while (matcher.find ())
{
System.out.println (matcher.group ());
}
}
}
你这不应该是正则表达式来完成的吧.看似是从Java里头出来的.你就直接加判断来完成就可以了.