D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2487 - regexp .* fails to capture space in a greedy way
Summary: regexp .* fails to capture space in a greedy way
Status: RESOLVED DUPLICATE of issue 2108
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-02 13:05 UTC by wade
Modified: 2014-03-01 00:36 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description wade 2008-12-02 13:05:18 UTC
The following regexp:

con = new RegExp(r"^(.*) .*$");

When used to find "y vn z w" returns "y" for the expression con.match(1).  It should match "y vn z".

Sample Code:

import std.stdio;
import std.regexp;

int main()
{
  RegExp con = new RegExp(r"^(.*) .*$");
  char[] line = "y vn z w";
  int ret = con.find(line);
  fwritef(stderr, "return value = %d, match(1) == %s\n", ret, con.match(1));
  return 0;
}
Comment 1 David Simcha 2009-10-18 07:44:51 UTC

*** This issue has been marked as a duplicate of issue 2108 ***