如何在java中为下面类似的句子编写正则表达式,并且应该只匹配句子的前三个字符
ins(clear(icl>remove>do,plf>thing,obj>thing,ins>thing).@entry.@past,evidence(icl>indication>thing))
我尝试了这段代码,但它也与句子中的明确证据相匹配....
String pattern2="[-a-z0-9R:._-`&=*'`~\"\\+[\\s]]+[\\(]";
Pattern r2 = Pattern.compile(pattern2);
Matcher m2 = r2.matcher(line);
while (m2.find())
{
rel = m2.group();
rel = rel.substring(0, rel.length()-1).trim();
System.out.println("The relation are " + rel);
}