Re: regex matching but not capturing

2023-04-06 Thread Ali Çehreli via Digitalmars-d-learn
On 4/6/23 11:08, Paul wrote: ways to access those repetitive ", cc" s on the end.  I don't think my regex is capturing them. Some internets think you are in parser territory: https://stackoverflow.com/questions/1407435/how-do-i-regex-match-with-grouping-with-unknown-number-of-groups Ali

Re: regex matching but not capturing

2023-04-06 Thread Paul via Digitalmars-d-learn
On Thursday, 6 April 2023 at 16:27:23 UTC, Alex Bryan wrote: My understanding browsing the documentation is the matchAll returns a range of Captures (struct documented at https://dlang.org/phobos/std_regex.html#Captures). In your for loop I think c[0] will contain the current full match (curre

Re: regex matching but not capturing

2023-04-06 Thread Alex Bryan via Digitalmars-d-learn
On Thursday, 6 April 2023 at 15:52:16 UTC, Paul wrote: My regex is matching but doesnt seem to be capturing. You may recognize this from the AOC challenges. file contains... **Valve AA has flow rate=0; tunnels lead to valves DD, II, BB** **Valve BB has flow rate=13; tunnels lead to valves CC,

Re: regex: ] in a character class

2020-12-12 Thread Tobias Pankrath via Digitalmars-d-learn
On Saturday, 12 December 2020 at 12:03:49 UTC, kdevel wrote: I don't have a suggestion for better wording yet. [1] https://dlang.org/phobos/std_regex.html This [1] is how I would word it. [1] https://github.com/dlang/phobos/pull/7724

Re: regex: ] in a character class

2020-12-12 Thread Tobias Pankrath via Digitalmars-d-learn
On Saturday, 12 December 2020 at 12:03:49 UTC, kdevel wrote: In some situations a ] must be escaped as in auto re = regex(`^[a\]]$`); // match a and ] only Unfortunately dmd/phobos does not warn if you forget the backslash: auto re = regex(`^[a]]$`); // match a] This leads me to the

Re: Regex and manipulating files

2020-11-16 Thread Jack via Digitalmars-d-learn
On Monday, 16 November 2020 at 10:51:51 UTC, Bloris wrote: I've to convert a linux dash script because it is too slow and i decded to do it in D. I'm totally new to this and i think it could be a good exercise to learn this language. The shell script does some simple jobs like: 0) Run the scri

Re: Regex split ignoore empty and whitespace

2020-02-20 Thread Ali Çehreli via Digitalmars-d-learn
On 2/20/20 4:46 PM, Ali Çehreli wrote: >auto range = std.regex.splitter!(No.keepSeparators)(l, > ctRegex!`[\s-\)\(\.]+`); After realizing that No.keepSeparators is the default value anyway, I tried 'split' and it worked the way you wanted. So, perhaps all you needed was that extra '+' in t

Re: Regex split ignoore empty and whitespace

2020-02-20 Thread Ali Çehreli via Digitalmars-d-learn
On 2/20/20 2:02 PM, AlphaPurned wrote:> std.regex.split(l, ctRegex!`[\s-\)\(\.]`); > > I'm trying too split a string on spaces and stuff... but it is returning > empty strings and other matches(e.g., ()). > > I realize I can delete afterwards but is there a direct way from split > or ctRegex? It

Re: Regex multiple matches

2017-04-13 Thread rikki cattermole via Digitalmars-d-learn
On 14/04/2017 3:54 AM, Jethro wrote: using the rule (?Pregex) e.g., (?P\w*)* how do we get at all the matches, e.g., Joe Bob Buddy? When I access the results captures they are are not arrays and I only ever get the first match even when I'm using matchAll. Pseudo code: foreach(result; match

Re: regex - match/matchAll and bmatch - different output

2016-01-02 Thread Ivan Kazmenko via Digitalmars-d-learn
On Friday, 1 January 2016 at 12:29:01 UTC, anonymous wrote: On 30.12.2015 12:06, Ivan Kazmenko wrote: As you can see, bmatch (usage discouraged in the docs) gives me the result I want, but match (also discouraged) and matchAll (way to go) don't. Am I misusing matchAll, or is this a bug? The

Re: regex - match/matchAll and bmatch - different output

2016-01-01 Thread anonymous via Digitalmars-d-learn
On 30.12.2015 12:06, Ivan Kazmenko wrote: import std.regex, std.stdio; void main () { writeln (bmatch ("abab", r"(..).*\1")); // [["abab", "ab"]] writeln (match("abab", r"(..).*\1")); // [["abab", "ab"]] writeln (matchAll ("abab", r"(..).*\1")); // [["abab", "ab"]]

Re: regex - match/matchAll and bmatch - different output

2015-12-31 Thread Ivan Kazmenko via Digitalmars-d-learn
On Wednesday, 30 December 2015 at 11:06:55 UTC, Ivan Kazmenko wrote: ... As you can see, bmatch (usage discouraged in the docs) gives me the result I want, but match (also discouraged) and matchAll (way to go) don't. Am I misusing matchAll, or is this a bug? Reported as https://issues.dlan

Re: regex format string problem

2015-11-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 23/11/15 9:22 PM, yawniek wrote: Hi Rikki, On Monday, 23 November 2015 at 03:57:06 UTC, Rikki Cattermole wrote: I take it that browscap[0] does it not do what you want? I have an generator at [1]. Feel free to steal. This looks interesting, thanks for the hint. However it might be a bit li

Re: regex format string problem

2015-11-23 Thread yawniek via Digitalmars-d-learn
Hi Rikki, On Monday, 23 November 2015 at 03:57:06 UTC, Rikki Cattermole wrote: I take it that browscap[0] does it not do what you want? I have an generator at [1]. Feel free to steal. This looks interesting, thanks for the hint. However it might be a bit limited, i have 15M+ different User A

Re: regex format string problem

2015-11-22 Thread Rikki Cattermole via Digitalmars-d-learn
On 23/11/15 12:41 PM, yawniek wrote: hi! how can i format a string with captures from a regular expression? basically make this pass: https://gist.github.com/f17647fb2f8ff2261d42 context: i'm trying to write a implementation for https://github.com/ua-parser where the regular expression as wel

Re: Regex start/end position of match?

2015-10-01 Thread Gerald via Digitalmars-d-learn
Thanks Adam, that was the hint I needed. For a given RegexMatch the pre().length() is essentially equivalent to the start position and taking pre().length + hit.length() gives the end position so I think this should be OK for my needs.

Re: Regex start/end position of match?

2015-10-01 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 1 October 2015 at 03:29:29 UTC, Gerald wrote: I'm stuck though on how to get the start/end index of a match? I couldn't find one either so I did the pre/post/hit things broken up. Take a look at this little program I wrote: http://arsdnet.net/dcode/replacer/ All the files it n

Re: Regex-Fu

2015-05-25 Thread Chris via Digitalmars-d-learn
On Monday, 25 May 2015 at 11:20:46 UTC, novice2 wrote: I cannot get the longest possible it match longest for first group ([a-z]+) try ^([a-z]+?)(hula|ula)$ Namespace, novice2: Ah, I see. The problem was with the first group that was too greedy, not with the second. I was focusing on the l

Re: Regex-Fu

2015-05-25 Thread novice2 via Digitalmars-d-learn
I cannot get the longest possible it match longest for first group ([a-z]+) try ^([a-z]+?)(hula|ula)$

Re: Regex-Fu

2015-05-25 Thread Namespace via Digitalmars-d-learn
On Monday, 25 May 2015 at 11:11:50 UTC, Chris wrote: I'm a bit at a loss here. I cannot get the longest possible match. I tried several versions with eager operators and stuff, but D's regex engine(s) always seem to return the shortest match. Is there something embarrassingly simple I'm missing

Re: regex on binary data

2014-12-31 Thread ketmar via Digitalmars-d-learn
On Wed, 31 Dec 2014 15:36:16 + Darrell via Digitalmars-d-learn wrote: > So far attempts to run regex on binary data causes > "Invalid UTF-8 sequence". > > Attempts to pass ubyte also didn't work out. current regex engine assumes that you are using UTF-8 encoded text. i really want regex eng

Re: regex on binary data

2014-12-31 Thread Tobias Pankrath via Digitalmars-d-learn
On Wednesday, 31 December 2014 at 15:36:19 UTC, Darrell wrote: So far attempts to run regex on binary data causes "Invalid UTF-8 sequence". Attempts to pass ubyte also didn't work out. I doubt using anything except (d,w)string is supported or possible.

Re: regex problems

2014-09-20 Thread AsmMan via Digitalmars-d-learn
On Saturday, 20 September 2014 at 15:28:54 UTC, seany wrote: consider this: import std.conv, std.algorithm; import core.vararg; import std.stdio, std.regex; void main() { string haystack = "ID : generateWorld; Position : { &

Re: regex problems

2014-09-20 Thread anonymous via Digitalmars-d-learn
On Saturday, 20 September 2014 at 15:28:54 UTC, seany wrote: In haystack, there are two such "ID :" -s. once at the beginning, ID : generateWorld. and then the final, last ID However, this is returning all 5 ID-s as match what am I doing wrong? Prints ID : ID : for me. I'd advise against

Re: Regex match in for loop

2014-07-15 Thread Brad Anderson via Digitalmars-d-learn
On Tuesday, 15 July 2014 at 20:18:58 UTC, seany wrote: Consider this: import std.stdio, std.regex, std.array, std.algorithms ; void main(string args[]) { string[] greetings = ["hello", "hallo", "hoi", "salut"]; regex r = regex("hello", "g"); for(short i = 0; i < greetings.count(); i++) {

Re: Regex match in for loop

2014-07-15 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jul 15, 2014 at 08:18:55PM +, seany via Digitalmars-d-learn wrote: > Consider this: > > import std.stdio, std.regex, std.array, std.algorithms ; > > void main(string args[]) > { > > string[] greetings = ["hello", "hallo", "hoi", "salut"]; > > regex r = regex("hello", "g"); > > for(

Re: Regex problem

2014-06-27 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jun 27, 2014 at 03:59:47PM +, seany via Digitalmars-d-learn wrote: [...] > core.exception.AssertError@std.regex(5587): Assertion failure > > ./niarbyl(_d_assertm+0x26) [0x4e6c26] > ./niarbyl() [0x4f45be] > ./niarbyl(pure nothrow @property @trusted immutable(char)[] > st

Re: RegEx for a simple Lexer

2014-05-14 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 13 May 2014 at 20:02:59 UTC, Tim Holzschuh via Digitalmars-d-learn wrote: Still: Would it be very difficult to write a suitable parser from scratch? See http://forum.dlang.org/post/lbnheh$2ssm$1...@digitalmars.com with duscussion about parsers on reddit.

Re: RegEx for a simple Lexer

2014-05-13 Thread Ary Borenszweig via Digitalmars-d-learn
On 5/13/14, 5:43 PM, anonymous wrote: On Tuesday, 13 May 2014 at 19:53:17 UTC, Tim Holzschuh via Digitalmars-d-learn wrote: If I also want to create a RegEx to filter string-expressions a la " xyz ", how would I do this? At least match( src, r"^\" (.*) $\" " ); doesn't seem to work and I couldn

Re: RegEx for a simple Lexer

2014-05-13 Thread Brian Schott via Digitalmars-d-learn
On Tuesday, 13 May 2014 at 19:53:17 UTC, Tim Holzschuh via Digitalmars-d-learn wrote: Hi there, I read a book about an introduction to creating programming languages (really basic). The sample code is written in Ruby, but I want to rewrite the examples in D. However, the Lexer uses Ruby's r

Re: RegEx for a simple Lexer

2014-05-13 Thread anonymous via Digitalmars-d-learn
On Tuesday, 13 May 2014 at 19:53:17 UTC, Tim Holzschuh via Digitalmars-d-learn wrote: If I also want to create a RegEx to filter string-expressions a la " xyz ", how would I do this? At least match( src, r"^\" (.*) $\" " ); doesn't seem to work and I couldn't find in the Library Reference how

Re: regex in tango.text.Util.containsPattern

2013-11-24 Thread seany
ah! thank you soo much

Re: regex in tango.text.Util.containsPattern

2013-11-24 Thread Jacob Carlborg
On 2013-11-22 21:03, seany wrote: How do i find strings in form of X... (in regex: X{Y*} using tango.text.Util.containsPattern ? the documentation does not mention regex. So i have a string where multiple substrngs in the format X{Y*} can appear, and I would like to identify all of them, it

Re: Regex matching cause lots of _d_arrayliteralTX calls

2013-09-27 Thread monarch_dodra
On Friday, 27 September 2013 at 15:22:14 UTC, H. S. Teoh wrote: On Fri, Sep 27, 2013 at 04:52:20PM +0200, JR wrote: On Friday, 27 September 2013 at 14:37:05 UTC, Dmitry Olshansky wrote: >27-Sep-2013 02:00, JR пишет: >And the answer is - don't use ENUM with ctRegex. The problem >is that >ctReg

Re: Regex matching cause lots of _d_arrayliteralTX calls

2013-09-27 Thread Dmitry Olshansky
27-Sep-2013 18:52, JR пишет: (I was of the notion that that enum merely translate to compile-time-evaluated constants.) I've recently investigated similar problem w.r.t. performance of std.regex on particular use-case/pattern. In fact it dig up an interesting bug with inlining in the compile

Re: Regex matching cause lots of _d_arrayliteralTX calls

2013-09-27 Thread H. S. Teoh
On Fri, Sep 27, 2013 at 04:52:20PM +0200, JR wrote: > On Friday, 27 September 2013 at 14:37:05 UTC, Dmitry Olshansky > wrote: > >27-Sep-2013 02:00, JR пишет: > > >And the answer is - don't use ENUM with ctRegex. The problem is that > >ctRegex returns you a pack of datastructures (=arrays). Using

Re: Regex matching cause lots of _d_arrayliteralTX calls

2013-09-27 Thread JR
On Friday, 27 September 2013 at 14:37:05 UTC, Dmitry Olshansky wrote: 27-Sep-2013 02:00, JR пишет: And the answer is - don't use ENUM with ctRegex. The problem is that ctRegex returns you a pack of datastructures (=arrays). Using them with enum makes it behave as if you pasted them as array

Re: Regex matching cause lots of _d_arrayliteralTX calls

2013-09-27 Thread Dmitry Olshansky
27-Sep-2013 02:00, JR пишет: I'm working on a toy IRC bot. Much of the logic involved is translating the incoming raw IRC string into something that makes sense (so now I have two problems, etc). But I managed to cook up a regex that so far seems to work well. Time for callgrind! Grouped by sour

Re: Regex matching cause lots of _d_arrayliteralTX calls

2013-09-26 Thread H. S. Teoh
On Fri, Sep 27, 2013 at 12:00:45AM +0200, JR wrote: > I'm working on a toy IRC bot. Much of the logic involved is > translating the incoming raw IRC string into something that makes > sense (so now I have two problems, etc). But I managed to cook up a > regex that so far seems to work well. Time fo

Re: Regex matching cause lots of _d_arrayliteralTX calls

2013-09-26 Thread H. S. Teoh
On Fri, Sep 27, 2013 at 01:51:51AM +0200, JR wrote: > On Thursday, 26 September 2013 at 23:04:22 UTC, bearophile wrote: > >I am not sure how a IRC bot could consume more than a tiny > >fraction of the CPU time of a modern multi-GHz processor. > > Nor does it bite into my 8 gigabytes of ram. > > F

Re: Regex matching cause lots of _d_arrayliteralTX calls

2013-09-26 Thread JR
On Thursday, 26 September 2013 at 23:04:22 UTC, bearophile wrote: I am not sure how a IRC bot could consume more than a tiny fraction of the CPU time of a modern multi-GHz processor. Nor does it bite into my 8 gigabytes of ram. Forgive me, but the main culprit in all of this is still me doing

Re: Regex matching cause lots of _d_arrayliteralTX calls

2013-09-26 Thread bearophile
JR: Is this working as expected? Or am I doing it wrong? I am not sure how a IRC bot could consume more than a tiny fraction of the CPU time of a modern multi-GHz processor. And I am not sure if regular expressions are a good idea to implement a IRC interface. But the author of the curre

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-30 Thread Diggory
Your suggestion does not work; try for yourself by replacing the $$ by \$ in my code. Is that a bug in std.regex' doc? eg: replace("",regex(``),`\$`); => invalid format string in regex replace However everything works fine with $$, see my code above. Either the doc or the code should probably

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-30 Thread Dmitry Olshansky
30-May-2013 10:49, Timothee Cour пишет: ok, here it is: https://github.com/timotheecour/dtools/blob/master/dtools/util/util.d#L78 simplified implementation and added missing escape symbols. Any symbol missing? I was basing myself based on http://dlang.org/phobos/std_regex.html, table entry '\c w

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-30 Thread Dmitry Olshansky
30-May-2013 14:24, Timothee Cour пишет: > According to this: http://dlang.org/phobos/std___regex.html#.replace you can use the same escape sequences for both (\c -> c in the replacement string). Your suggestion does not work; try for yourself by

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-30 Thread Timothee Cour
> According to this: > http://dlang.org/phobos/std_**regex.html#.replace > you can use the same escape sequences for both (\c -> c in the replacement string). Your suggestion does not work; try for yourself by replacing the $$ by \$ in my code. Is

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-30 Thread Diggory
On Thursday, 30 May 2013 at 06:50:06 UTC, Timothee Cour wrote: ok, here it is: https://github.com/timotheecour/dtools/blob/master/dtools/util/util.d#L78 simplified implementation and added missing escape symbols. Any symbol missing? I was basing myself based on http://dlang.org/phobos/std_reg

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-29 Thread Timothee Cour
ok, here it is: https://github.com/timotheecour/dtools/blob/master/dtools/util/util.d#L78 simplified implementation and added missing escape symbols. Any symbol missing? I was basing myself based on http://dlang.org/phobos/std_regex.html, table entry '\c where c is one of', but that was incomplete

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-29 Thread Diggory
On Wednesday, 29 May 2013 at 23:33:30 UTC, timotheecour wrote: something like this, which we should have in std.regex: string escapeRegex(string a){ import std.string; enum transTable = ['[' : `\[`, '|' : `\|`, '*': `\*`, '+': `\+`, '?': `\?`, '(': `\(`, ')': `\)`]; return tra

Re: regex with literal (ie automatically replace '(' with '\(', etc) )

2013-05-29 Thread timotheecour
something like this, which we should have in std.regex: string escapeRegex(string a){ import std.string; enum transTable = ['[' : `\[`, '|' : `\|`, '*': `\*`, '+': `\+`, '?': `\?`, '(': `\(`, ')': `\)`]; return translate(a, transTable); } string escapeRegexReplace(string a){

Re: Regex - replace example fails for more than 6 digits

2012-12-26 Thread Peter Summerland
On Wednesday, 26 December 2012 at 21:16:30 UTC, Dmitry Olshansky wrote: 12/26/2012 9:26 PM, Peter Summerland пишет: I tried the example from the std.regex documentation: //Comify a number auto com = regex(r"(?<=\d)(?=(\d\d\d)+\b)","g"); assert(replace("12000 + 42100 = 54100", com, ",") == "12,0

Re: Regex - replace example fails for more than 6 digits

2012-12-26 Thread Dmitry Olshansky
12/26/2012 9:26 PM, Peter Summerland пишет: I tried the example from the std.regex documentation: //Comify a number auto com = regex(r"(?<=\d)(?=(\d\d\d)+\b)","g"); assert(replace("12000 + 42100 = 54100", com, ",") == "12,000 + 42,100 = 54,100"); It did not work for me when I entered numbers wi

Re: Regex question

2012-03-28 Thread Dmitry Olshansky
On 28.03.2012 13:40, James Blewitt wrote: I'm having a problem with regexes. The following code gives a compilation error. If I comment out the regex outside of main and comment in the regex inside of main then it does compile. Please include compilation errors in future, it helps folks to figu

Re: Regex question

2012-03-28 Thread simendsjo
On Wed, 28 Mar 2012 11:40:21 +0200, James Blewitt wrote: I'm having a problem with regexes. The following code gives a compilation error. If I comment out the regex outside of main and comment in the regex inside of main then it does compile. I'm using DMD v2.058 Any ideas what is going

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
oking into. Fill the bug report plz. 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 = ctRegex!(`(".*")|('.*')`,

Re: regex: force entire string to match

2012-01-31 Thread bearophile
NewName: > Hello all. > I want to write a regex to check if a whole string is a number. Also: import std.stdio, std.string, std.array; void main() { string s = "123"; assert(s.removechars("0-9").empty); } Bye, bearophile

Re: regex: force entire string to match

2012-01-31 Thread NewName
> You want to match the beginning and end of the input as well: > "^[0-9]+$" Thanks.

Re: regex: force entire string to match

2012-01-31 Thread Justin Whear
On Tue, 31 Jan 2012 16:29:43 +, NewName wrote: > Hello all. > I want to write a regex to check if a whole string is a number. With my > current regex("[0-9]+") numbers will be carved out of things like > "aaa456" (hit: 456) and I circumvent this by checking the lengths for > inequality, which

Re: regex: force entire string to match

2012-01-31 Thread Trass3r
I want to write a regex to check if a whole string is a number. With my current regex("[0-9]+") numbers will be carved out of things like "aaa456" (hit: 456) and I circumvent this by checking the lengths for inequality, which is stupid. My regex is surely missing something? Try ^ and $ if applic

Re: regex escapes

2011-02-16 Thread Jesse Phillips
spir Wrote: > Hello, > > Which characters are to be escaped: > * inside [] classes > * outside such classes > ? > > Also, is there for D regexes a "free form" format (where whitespace can be > used > to present formats more legibly, but must be escaped as literals)? Though you are probably as

Re: regex escapes

2011-02-16 Thread Alex Folland
On 2011-02-16 5:48, spir wrote: Hello, Which characters are to be escaped: * inside [] classes * outside such classes ? Also, is there for D regexes a "free form" format (where whitespace can be used to present formats more legibly, but must be escaped as literals)? Denis This is a comment

Re: regex start-of-line

2011-02-12 Thread spir
On 02/12/2011 06:57 PM, Jesse Phillips wrote: "The pipe has the lowest precedence of all operators." Right, I guess this answers my question :) Denis -- _ vita es estrany spir.wikidot.com

Re: regex start-of-line

2011-02-12 Thread Jesse Phillips
spir Wrote: > Hello, > > I have a regex bug in following conditions: users pass a series of regex > formats (strings) from which I create regex engines later used for lexing. To > ensure matching at start of (rest of) source, I prefix each format with '^'. > Right in most cases. But the follow

Re: Regex

2009-07-11 Thread Lutger
BLS wrote: > Robert Fraser wrote: >> BLS wrote: >>> Vladimir Voinkov wrote: std.regex can't be used in compile time function call. It's quite frustrating... >>> >>> see dsource.org .. afaik there is a compile time regex project. hth >> >> http://www.dsource.org/projects/scregexp >> >>

Re: Regex

2009-07-11 Thread Vladimir Voinkov
> >> see dsource.org .. afaik there is a compile time regex project. hth > > > > http://www.dsource.org/projects/scregexp > > > > But the generated functions aren't CTFE-compatible AFAIK. A CTFE regex > > engine would be um... "tricky" to say the least. About 50GB of memory > > tricky (on DMD,

Re: Regex

2009-07-10 Thread BLS
Robert Fraser wrote: BLS wrote: Vladimir Voinkov wrote: std.regex can't be used in compile time function call. It's quite frustrating... see dsource.org .. afaik there is a compile time regex project. hth http://www.dsource.org/projects/scregexp But the generated functions aren't CTFE-comp

Re: Regex

2009-07-09 Thread Robert Fraser
BLS wrote: Vladimir Voinkov wrote: std.regex can't be used in compile time function call. It's quite frustrating... see dsource.org .. afaik there is a compile time regex project. hth http://www.dsource.org/projects/scregexp But the generated functions aren't CTFE-compatible AFAIK. A CTFE r

Re: Regex

2009-07-09 Thread BLS
Vladimir Voinkov wrote: std.regex can't be used in compile time function call. It's quite frustrating... see dsource.org .. afaik there is a compile time regex project. hth