import org.apache.regexp.RE;
RE r = null;
String text = "ABDBbghghghdgnjgfjfghjhgjhghjkghjhhghhjj"
// si le text attient une certaine taille "40 lignes", StackOverflowError est genèré.
String regex = "([a-zA-Z \r\n]{1,})"; //par exemple
try{
r = new RE(regex,RE.MATCH_MULTILINE);
Boolean bool= r.match(text);
if(bool)
{
String str="";
for (int i = 0; i < r.getParenCount(); i++)
{
if(r.getParenLength(i)>0)
{
System.out.println(r.getParen(i));
}
else
{
System.out.println("NO MATCH");
}
}//end for
}//end if
else
{
Form.Groups.addItem("Failed match");
}
}catch(RESyntaxException REex) {Form.Groups.addItem(REex);}
catch(java.lang.StackOverflowError st){System.out.println("st "+st);}
catch(java.lang.InternalError ec){System.out.println("ec "+ec);}
catch(java.lang.StringIndexOutOfBoundsException in){System.out.println("in "+in);}
try{
this.finalize();
}catch(java.lang.Throwable g){System.out.println("g "+g);}
}
}
Partager