From: SourceForge.net <no...@so...> - 2007-05-24 14:37:23
|
Feature Requests item #1721235, was opened at 2007-05-18 03:58 Message generated for change (Comment added) made by ezust You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=350588&aid=1721235&group_id=588 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Skeeve (ngc) Assigned to: Nobody/Anonymous (nobody) Summary: switch from java.util.regex to ... another one ;-) Initial Comment: java.util.regex has severe problems with regular expressions using alternatives (the "|"). Please refer to sun bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4675952 There is a solution provided switching from java.utiol.regex to http://javaregex.com/ ---------------------------------------------------------------------- >Comment By: Alan Ezust (ezust) Date: 2007-05-24 07:37 Message: Logged In: YES user_id=935841 Originator: NO If it is for search/replace, you can try using the xsearch plugin, which is still using the gnu.regexp library and behaves as jEdit used to. ---------------------------------------------------------------------- Comment By: Skeeve (ngc) Date: 2007-05-24 02:21 Message: Logged In: YES user_id=864970 Originator: YES Not exactly the same result as it also matches <!--->. I already have a working alternative. But it's not that it's just this one regex that shows the problem. And I'm also sure most of them can be translated to working alternatives. But I'm also sure that a) It's not always easy to find an alternativ and b) it's impossible to find one if you don't know that your regex made the regex util fail! case b is what worries me most! So alerting the user in such a case with "Your regex is to complex. Please use an alternative one" might be a workaround. And to give you the working alternative (tbh... Ididn't test it with "gigantic" comments ;-)) it's "<!--[^-]*(-[^-]+)*-->" But I had to ask the perlmonks for assistance. ---------------------------------------------------------------------- Comment By: Skeeve (ngc) Date: 2007-05-24 01:43 Message: Logged In: YES user_id=864970 Originator: YES You *think* it works and in many cases it really does. This is what I label "unreliable"! simply make a big enough xml comment and you will note the bug. Please see jEdit bug entry 1719268 for a discussion https://sourceforge.net/tracker/index.php?func=detail&aid=1719268&group_id=588&atid=100588 ---------------------------------------------------------------------- Comment By: Björn Kautler (vampire0) Date: 2007-05-24 01:42 Message: Logged In: YES user_id=918212 Originator: NO And btw. a replacement for your XML comments searching regexp should be: <!--?(-[^-]+)*--> This should achieve exactly the same results than your regexp I think. But if it has errors, tell me, I'm no Regex expert. ---------------------------------------------------------------------- Comment By: Björn Kautler (vampire0) Date: 2007-05-24 01:31 Message: Logged In: YES user_id=918212 Originator: NO I don't think we will change the regex engine again. And certainly not back to gnu.regexp. gnu.regexp had its own problems and quirks and it was unmaintained and an external dependency. For me regexes with alternation work fine. Even your regex for searching XML comments works for me as expected. ---------------------------------------------------------------------- Comment By: Skeeve (ngc) Date: 2007-05-24 01:07 Message: Logged In: YES user_id=864970 Originator: YES Just a comment: I don't insist on Stevesoft but I request not to use Sun's library except if you can easily com up with a working alternative for the regex: "<!--([^-]|-[^-])*-->" It means: search XML Comments. Thy may contain anything but 2 adjacent "-" ---------------------------------------------------------------------- Comment By: Skeeve (ngc) Date: 2007-05-19 20:27 Message: Logged In: YES user_id=864970 Originator: YES Problem with sticking to Sun's library are: 1) It's not reliable 2) Users might search but don't find anyything because of the stack overflow they don't see 3) It might be complicated or impossible to find another regex that matches the same strings If there's really noone agreeing with me that an unreliable library shouldn't be used, there should be at least a hint that the regex the user used is too complex to be handled. I guess there is some try ... catch going on which suppresses the stack overflow exception. The Stack Overflow should be catched and signaled here so that the user has at least achance to change his regex or even his editor... ---------------------------------------------------------------------- Comment By: Marcelo Vanzin (vanza) Date: 2007-05-19 16:24 Message: Logged In: YES user_id=75113 Originator: NO The problem is: we switched to java.util.regex exactly so we would avoid depending on an external library. If we wanted to stick with another library, we probably would have kept gnu.regexp around. So I don't think switching to another library will be done. If Java's regex system was pluggable (like the XML parsers are), then it would be simple, but it's not. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=350588&aid=1721235&group_id=588 |