digitalmars.D.bugs - [Issue 1772] New: regexp.split behaves incorrectly for paths with captures
- d-bugmail puremagic.com Jan 07 2008
- d-bugmail puremagic.com Jan 07 2008
- d-bugmail puremagic.com Jan 08 2008
- d-bugmail puremagic.com Oct 11 2009
- d-bugmail puremagic.com Jun 04 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1772 Summary: regexp.split behaves incorrectly for paths with captures Product: D Version: 1.025 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: wbaxter gmail.com I want to split columns out of a row of numbers. They may be separated by comas or by just white space. So I tried this: The splitter regexp auto re_splitter = new RegExp(r"(\s+|\s*,\s*)"); char[][] numbers = re_splitter.split(line); if input is a line like: 410.90711,352.879 The output from that is the array [410.90711,,,352.879] After a bit of debugging, it turns out the problem is the grouping in the regexp. Removing the parens fixes the problem in this case, but there are cases where you need parens for grouping and not for the capturing side effect. So I think this is a bug. Only match 0 should be considered significant for splitting, not the submatches. --
Jan 07 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1772 wbaxter gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|regexp.split behaves |regexp.split behaves |incorrectly for paths with |incorrectly using regexps |captures |with captures ------- Comment #1 from wbaxter gmail.com 2008-01-07 23:04 ------- fixed summary --
Jan 07 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1772 wbaxter gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|regexp.split behaves |regexp.split behavior with |incorrectly using regexps |captures needs to be |with captures |documented ------- Comment #2 from wbaxter gmail.com 2008-01-08 14:12 ------- It seems I've been duped by writefln's output. Further investigation shows that this: [410.90711,,,352.879] is actually this: ["410.90711", ",", "352.879"] and not a 4-element list with two empty strings as I thought. I discovered this because I checked what python does with captures, and it is this: """ If capturing parentheses are used in pattern, then the text of all groups in the pattern are also returned as part of the resulting list. """ So that made me think maybe D could be trying to do something similar. Apparently it is. So please just document it. --
Jan 08 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1772 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei metalanguage.com AssignedTo|nobody puremagic.com |andrei metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 11 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1772 Andrei Alexandrescu <andrei metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|andrei metalanguage.com |dmitry.olsh gmail.com --- Comment #3 from Andrei Alexandrescu <andrei metalanguage.com> 2011-06-04 17:48:10 PDT --- Reassigning to Dmitry. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 04 2011









d-bugmail puremagic.com 