Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Gene Wirchenko Newsgroups: comp.lang.java.programmer Subject: Re: Debugging regexes Date: Fri, 25 Apr 2014 10:09:22 -0700 Organization: A noiseless patient Spider Lines: 21 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: mx05.eternal-september.org; posting-host="60d0d39a542030f45c674d6e1df82370"; logging-data="15137"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19oHwMcqlNbhaTwTCNA0tfjeK0DzTycwjA=" X-Newsreader: Forte Agent 4.2/32.1118 Cancel-Lock: sha1:vIRu+k0A0+IsKQhBSwUbieagccQ= Xref: csiph.com comp.lang.java.programmer:28232 On Thu, 24 Apr 2014 05:39:38 -0700, Roedy Green wrote: >Regexes are black box. If they fail, you have no idea where. True. For that reason, I often use a finite state automaton. A regex either succeeds or fails. I prefer to pick up more information. When I use regexes, I keep them simple, because debugging one can be a real bear. I will use short regexes with glue code rather than one monster. >It would be nice if Matcher had some debugging methods to tell you the >offset and length of the best/longest match it was able to make, even >if it did not completely match. I wish that there were not so many varieties regex languages. Sincerely, Gene Wirchenko