[Issue 7962] std.regex: Captures.length() returns incorrect value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 21 14:11:02 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7962
Dmitry Olshansky <dmitry.olsh at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |pull
CC| |dmitry.olsh at gmail.com
--- Comment #1 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2012-04-21 14:11:59 PDT ---
(In reply to comment #0)
> It seems that Captures.length() from std.regex returns bogus lengths for empty
> captures (I might be using it improperly). Here's a simple example, the second
> match object claims length 2 while being empty.
>
Thanks for the detailed info. The problem is that Captures.length is hardwired
to the number of sub captures + 1 which is fine as long as there is a match.
For now you may use m.empty ? 0 : m.length as a workaround.
Pull:
https://github.com/D-Programming-Language/phobos/pull/548
P.S. Usage of e.g. length() is deprecated and fails with -property switch. Omit
parens for @property members.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list