Re: regex issue

2012-03-20 Thread James Miller
On 21 March 2012 04:26, Jay Norwood wrote: > yes, thanks.  I read your other link and that was helpful.   I think I > presumed that the escape handling was something belonging to stdio, while > regex would have its own valid escapes that would include \p.  But I see now > that the string literals

Re: regex issue

2012-03-20 Thread Jay Norwood
On Tuesday, 20 March 2012 at 10:28:11 UTC, Dmitry Olshansky wrote: Note that if your task is to split buffer by exactly '\n' byte then loop with memchr is about as fast as it gets, no amount of magic compiler optimizations would make other generic ways better (even theoretically). What they *co

Re: regex issue

2012-03-20 Thread Dmitry Olshansky
On 19.03.2012 23:24, Jay Norwood wrote: On Monday, 19 March 2012 at 13:55:39 UTC, Dmitry Olshansky wrote: That's right, however counting is completely separate from regex, you'd want to use std.algorithm count: count(match(,"\n")); or more unicode-friendly: count(match(, regex("$","m"))

Re: regex issue

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 19:24:30 UTC, Jay Norwood wrote: This fails to build, so I'd guess is missing \p void wcp (string fn) { enum ctr = ctRegex!("\p{WhiteSpace}","m"); } -- Build started: Project: a7, Configuration: Release Win32 -- Building Release\a7.exe... a7.d(210):

Re: regex issue

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 13:55:39 UTC, Dmitry Olshansky wrote: That's right, however counting is completely separate from regex, you'd want to use std.algorithm count: count(match(,"\n")); or more unicode-friendly: count(match(, regex("$","m")); //note the multi-line flag This only

Re: regex issue

2012-03-19 Thread Dmitry Olshansky
On 19.03.2012 17:39, Jay Norwood wrote: On Monday, 19 March 2012 at 13:27:03 UTC, Jay Norwood wrote: ok, global. So the document implies that I should be able to get a single match object with a count of the submatches. So I think maybe I've jumped to the wrong conclusion about how to use it, th

Re: regex issue

2012-03-19 Thread Dmitry Olshansky
On 19.03.2012 17:27, Jay Norwood wrote: On Monday, 19 March 2012 at 08:05:18 UTC, Dmitry Olshansky wrote: Like I told in main D group it's wrong - regex doesn't only count matches. It finds slices that do match. Thus to make it more efficient, it returns lazy range that does searches on request.

Re: regex issue

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 13:27:03 UTC, Jay Norwood wrote: ok, global. So the document implies that I should be able to get a single match object with a count of the submatches. So I think maybe I've jumped to the wrong conclusion about how to use it, thinking I could just use "\n" and "g"

Re: regex issue

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 08:05:18 UTC, Dmitry Olshansky wrote: Like I told in main D group it's wrong - regex doesn't only count matches. It finds slices that do match. Thus to make it more efficient, it returns lazy range that does searches on request. "g" - means global :) Then code like t

Re: regex issue

2012-03-19 Thread Dmitry Olshansky
On 19.03.2012 16:59, Jay Norwood wrote: On Monday, 19 March 2012 at 08:14:18 UTC, Dmitry Olshansky wrote: On 19.03.2012 12:05, Dmitry Olshansky wrote: In that case, I should have been able to do something like: matches=match(input,ctr); l_cnt = matches.length(); I'm curious what this lengt

Re: regex issue

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 08:14:18 UTC, Dmitry Olshansky wrote: On 19.03.2012 12:05, Dmitry Olshansky wrote: In that case, I should have been able to do something like: matches=match(input,ctr); l_cnt = matches.length(); I'm curious what this length() does as I have no length for RegexMa

Re: regex issue

2012-03-19 Thread Dmitry Olshansky
On 19.03.2012 12:05, Dmitry Olshansky wrote: On 19.03.2012 6:50, Jay Norwood wrote: On Friday, 16 March 2012 at 03:36:12 UTC, Joshua Niehus wrote: Hello, Does anyone know why I would get different results between ctRegex and regex in the following snippet? Thanks, Josh I'm also having que

Re: regex issue

2012-03-19 Thread Dmitry Olshansky
On 19.03.2012 6:50, Jay Norwood wrote: On Friday, 16 March 2012 at 03:36:12 UTC, Joshua Niehus wrote: Hello, Does anyone know why I would get different results between ctRegex and regex in the following snippet? Thanks, Josh I'm also having questions about the matchers. From what I underst

Re: regex issue

2012-03-18 Thread Jay Norwood
On Friday, 16 March 2012 at 03:36:12 UTC, Joshua Niehus wrote: Hello, Does anyone know why I would get different results between ctRegex and regex in the following snippet? Thanks, Josh I'm also having questions about the matchers. From what I understand in the docs, if I use this greedy

Re: regex issue

2012-03-17 Thread Dmitry Olshansky
On 16.03.2012 20:05, Joshua Niehus wrote: On Friday, 16 March 2012 at 08:34:18 UTC, Dmitry Olshansky wrote: Ehm, because they have different engines that _should_ give identical results. And the default one apparently has a bug, that I'm looking into. Fill the bug report plz. Ok, submitted: id

Re: regex issue

2012-03-16 Thread Joshua Niehus
On Friday, 16 March 2012 at 08:34:18 UTC, Dmitry Olshansky wrote: Ehm, because they have different engines that _should_ give identical results. And the default one apparently has a bug, that I'm looking into. Fill the bug report plz. Ok, submitted: id 7718 Thanks, Josh

Re: regex issue

2012-03-16 Thread Dmitry Olshansky
On 16.03.2012 7:36, Joshua Niehus wrote: Hello, Does anyone know why I would get different results between ctRegex and regex in the following snippet? Ehm, because they have different engines that _should_ give identical results. And the default one apparently has a bug, that I'm looking into

regex issue

2012-03-15 Thread Joshua Niehus
Hello, Does anyone know why I would get different results between ctRegex and regex in the following snippet? Thanks, Josh --- #!/usr/local/bin/rdmd import std.stdio, std.regex; void main() { string strcmd = "./myApp.rb -os OSX -path \"/GIT/Ruby Apps/sec\" -conf 'no timer'"; auto ctre