simple "find" question
WhatMeWorry
kc_heaser at yahoo.com
Mon May 7 17:42:08 PDT 2012
On Monday, 7 May 2012 at 19:45:36 UTC, WhatMeWorry wrote:
> I get a comiler error for some older code which uses regexp.find
>
> if (std.regexp.find(pText, lMacro.Pattern, "m") != -1)
>
> Ok. So I look at the phobos docs and find:
>
> deprecated sizediff_t find(string s, string pattern, string
> attributes = null); Returns:
>
> Same as find(s, RegExp(pattern, attributes)).
>
> WARNING:
> This function is scheduled for deprecation due to unnecessary
> ambiguity with the homonym function in std.string. Instead of
> std.regexp.find(s, p, a), you may want to use find(s, RegExp(p,
> a)).
>
> But I can't find "find(s, RegExp(p, a))". There is an entry in
> std.algorithm but does a haystack and needle coorespond to a
> string and regular expression.
>
> And std.regex talks about "matches" and stuff but is this
> equivalent to "find".
Think I found it. CountUntil gives me a index.
assert(countUntil("hello world", "world") == 6);
Will study more, and post less.
More information about the Digitalmars-d-learn
mailing list