find

Search s[] for first match with pattern.

  1. sizediff_t find(string s, RegExp pattern)
    sizediff_t
    find
    (
    string s
    ,)
  2. sizediff_t find(string s, string pattern, string attributes)

Parameters

s string

String to search.

pattern RegExp

Regular expression pattern.

Return Value

Type: sizediff_t

index into s[] of match if found, -1 if no match.

Examples

auto s = "abcabcabab";
find(s, RegExp("b"));    // match, returns 1
find(s, RegExp("f"));    // no match, returns -1

Meta