RegExp.test

* Search s[] for match. * Returns: 0 for no match, !=0 for match * Example:

import std.stdio;
import undead.regexp;
import std.string;

int grep(int delegate(char[]) pred, char[][] list)
{
  int count;
  foreach (s; list)
  {  if (pred(s))
       ++count;
  }
  return count;
}

void main()
{
  auto x = grep(&RegExp("[Ff]oo").test,
                std.string.split("mary had a foo lamb"));
  writefln(x);
}

which prints: 1

  1. bool test(string s)
    class RegExp
    bool
    test
    (
    string s
    )
  2. int test()
  3. int test(string s, size_t startindex)

Meta