Fuzzy string matching?
dsmith
ds at nomail.com
Fri Jul 15 23:17:56 PDT 2011
Could you demonstrate how to use std.regex for pattern matching, preferably with a bool method?
My usage of std.regex.match yields this error: core.exception.AssertError@/usr/include/d/dmd/phobos/std/regex.d(1796): 4294967295 .. 4294967295 vs. 5
My usage is: auto m = match(long_string, regex(str));
writeln(m.hit);
== Repost the article of Jonathan M Davis (jmdavisProg at gmx.com)
== Posted at 2011/07/16 01:08 to digitalmars.D.learn
On Saturday 16 July 2011 05:07:38 dsmith wrote:
> Until recently, you could easily use std.regexp.search(target_string,
> find_string), but regexp is apparently no longer in phobos. I seek a
> simple substitute. std.algorithm.canFind might work, as it is bool.
>
> Maybe try something like:
>
> foreach(str; strings)
> foreach(fls; system_files)
> if(std.algorithm.canFind(fls, str)) // usage needs verification
> str ~= ".ext";
std.regex is std.regexp's replacement.
- Jonathan M davis
More information about the Digitalmars-d-learn
mailing list