The Artima Developer Community
Sponsored Link

Java Buzz Forum
java.util.regex.Pattern StackOverflowError's on (x|y)*

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Matt Quail

Posts: 128
Nickname: spud
Registered: Jun, 2003

Matt Quail is lead programmer for a Java development company
java.util.regex.Pattern StackOverflowError's on (x|y)* Posted: Aug 27, 2004 11:33 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Matt Quail.
Original Post: java.util.regex.Pattern StackOverflowError's on (x|y)*
Feed Title: Matt Quail's Java blog
Feed URL: http://fisheye.cenqua.com/category/java/feed/
Feed Description: The latest java related logs from Matt Quail's blog at madbean.com
Latest Java Buzz Posts
Latest Java Buzz Posts by Matt Quail
Latest Posts From Matt Quail's Java blog

Advertisement

I've been doing a fair whack of regex processing in Java recently. I must admit that having a regex library in the language is very useful, and Java's java.util.regex.Pattern implements a very complete regex library (all the "Perl5" stuff, non-greedy quantifiers, Unicode character classes, etc).

So I was completely surprised when it started throwing StackOverflowError. The following code highlights the problem (reproduced on Sun's JDK1.5.0-b2 and JDK1.4.2_01). Any pattern like (x|y)* (an alternative wrapped in a star) is implemented recursively by Pattern. Each matched alternative uses about 5 method calls on the stack.


more...

Read: java.util.regex.Pattern StackOverflowError's on (x|y)*

Topic: Treating your people bad will bite you in the ass...who knew? Previous Topic   Next Topic Topic: Running the JWSDP 1.4 WSI Sample Application with Tomcat and Hypersonic SQL

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use