« Return to Thread: Certain non-zero-length non-matching regexes run forever on Saxon

Re: Certain non-zero-length non-matching regexes run forever on Saxon

by Abel Braaksma (online) :: Rate this Message:

Reply to Author | View in Thread

Owen Rees wrote:
> --On Tuesday, January 23, 2007 17:18:56 +0100 Abel Braaksma wrote:
>  
> In this case, the problem is in the Java regex engine but according to
> <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6393051> and the
> related entries in the Java bug database some matches have exponential time
> complexity, at least with the algorithms Java uses so this is not a bug
> they intend to fix. (I don't know if there are other algorithms that can
> handle such cases.)
>  

There are, plenty. Try Ruby, Perl, Python etc. None of these seem to
have the same problem.

> An alternative for the particular case that seems not to cause the problem
> is:
>
> <xsl:variable name="regex">("[^"]*")+</xsl:variable>
>  

Thanks, Owen. That surely solves this particular problem. I didn't want
to go into too much detail, but I run into this problem more often than
I could hope for. I always make sure that the total regex is never
zero-length, but I cannot be sure of the sub matches (not always, at least).

The problem gets more complex in light of bidi text, where this
originated. However, since this seems to be a Java problem, I'll just
have to make sure that I thoroughly test every regex for production
quality...

-- Abel

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
saxon-help mailing list
saxon-help@...
https://lists.sourceforge.net/lists/listinfo/saxon-help

 « Return to Thread: Certain non-zero-length non-matching regexes run forever on Saxon