Re: std.algorithm.startsWith with maximal matching

2012-01-15 Thread Jonathan M Davis
On Sunday, January 15, 2012 11:23:04 H. S. Teoh wrote: > On Sat, Jan 14, 2012 at 07:53:10PM -0800, Jonathan M Davis wrote: > [...] > > > Actually, if the word has to match exactly, then startsWith isn't > > going to cut it. What you need to do is outright strip the punctuation > > from both ends.

Re: std.algorithm.startsWith with maximal matching

2012-01-15 Thread H. S. Teoh
On Sat, Jan 14, 2012 at 07:53:10PM -0800, Jonathan M Davis wrote: [...] > Actually, if the word has to match exactly, then startsWith isn't > going to cut it. What you need to do is outright strip the punctuation > from both ends. You'd need something more like > > word = find!(not!(std.uni.isPun

Re: std.algorithm.startsWith with maximal matching

2012-01-14 Thread Jonathan M Davis
On Saturday, January 14, 2012 19:45:55 Jonathan M Davis wrote: > If you have to worry about punctuation, then == isn't going to work. You'll > need to use some other combination of functions to strip the punctuation > from one or both ends of the word. One possible solution would be something > lik

Re: std.algorithm.startsWith with maximal matching

2012-01-14 Thread Jonathan M Davis
On Saturday, January 14, 2012 19:13:02 H. S. Teoh wrote: > On Fri, Jan 13, 2012 at 09:30:35PM -0800, Jonathan M Davis wrote: > > On Friday, January 13, 2012 18:47:19 H. S. Teoh wrote: > [...] > > > > But what I really want to accomplish is to parse a string containing > > > multiple words; at each

Re: std.algorithm.startsWith with maximal matching

2012-01-14 Thread H. S. Teoh
On Fri, Jan 13, 2012 at 09:30:35PM -0800, Jonathan M Davis wrote: > On Friday, January 13, 2012 18:47:19 H. S. Teoh wrote: [...] > > But what I really want to accomplish is to parse a string containing > > multiple words; at each point I have a list of permitted words that > > need to be matched ag

Re: std.algorithm.startsWith with maximal matching

2012-01-13 Thread Jonathan M Davis
On Friday, January 13, 2012 18:47:19 H. S. Teoh wrote: > On Fri, Jan 13, 2012 at 09:36:07PM -0500, Jonathan M Davis wrote: > > On Friday, January 13, 2012 16:48:00 H. S. Teoh wrote: > > > Hi all, > > > > > > I'm reading the docs for startsWith(A,B...) with multiple ranges in > > > B, > > > and it

Re: std.algorithm.startsWith with maximal matching

2012-01-13 Thread H. S. Teoh
On Fri, Jan 13, 2012 at 09:36:07PM -0500, Jonathan M Davis wrote: > On Friday, January 13, 2012 16:48:00 H. S. Teoh wrote: > > Hi all, > > > > I'm reading the docs for startsWith(A,B...) with multiple ranges in B, > > and it seems that it will always match the *shortest* range whenever > > more th

Re: std.algorithm.startsWith with maximal matching

2012-01-13 Thread Jonathan M Davis
On Friday, January 13, 2012 16:48:00 H. S. Teoh wrote: > Hi all, > > I'm reading the docs for startsWith(A,B...) with multiple ranges in B, > and it seems that it will always match the *shortest* range whenever > more than one range in B matches. Is there a way to make it always match > the *longe