Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Jim Janney Newsgroups: comp.lang.java.programmer Subject: Re: Keeping the split token in a Java regular expression Date: Tue, 27 Mar 2012 09:21:56 -0600 Organization: thinking of Maud you forget everything else Lines: 18 Message-ID: <2pr4we9ii3.fsf@shell.xmission.com> References: <48d35bc3-a391-4ccf-a222-dac64775a2f2@oq7g2000pbb.googlegroups.com> <2pvclq9lll.fsf@shell.xmission.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="PnllQd880uOddfy6hsxHuQ"; logging-data="22972"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/6TKQ8bOLZ72BXws+JnJaA" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:f50yxKvtQXBC2Dy0bfsZDU3vIkk= sha1:GqWYA9qUrZL1pdcnTUiEi4d//rQ= Xref: csiph.com comp.lang.java.programmer:13226 laredotornado writes: > On Mar 27, 9:15 am, Jim Janney wrote: >> laredotornado writes: > > Jim, That's absolutely brilliant and does exactly what I want in a > short amount of code. > > Stefan, thanks for your solution as well. I tried that out first and > it works too. - Dave It turns out that lookbehind only works with some patterns; the engine has to be able to determine the length of the match in advance. Not surprising when you think about it. It's an interesting question and gave me a reason to learn something new. -- Jim Janney