StackOverflowError occured as using java.util.regex.Matcher

Posted by Captain Kidd on Stack Overflow See other posts from Stack Overflow or by Captain Kidd
Published on 2010-03-03T09:31:33Z Indexed on 2010/03/09 1:51 UTC
Read the original article Hit count: 354

Filed under:
|

Hi guys I try to catch text by Regular Expression. I list codes as follows.

Pattern p=Pattern.compile("<@a>(?:.|\\s)+?</@a>"); 
Matcher m = p.matcher(fileContents.toString());
while(m.find()) {
    //Error will be thrown at this point
    System.out.println(m.group());
}

If the length of text I want to catch is too long, system will throw me a StackOverflowError. Otherwise, the codes work well. Please help me how to solve this problem.

© Stack Overflow or respective owner

Related posts about java

Related posts about regex