rfind

Search s[] for last match with pattern.

  1. sizediff_t rfind(string s, RegExp pattern)
    sizediff_t
    rfind
    (
    string s
    ,)
  2. sizediff_t rfind(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";
rfind(s, RegExp("b"));    // match, returns 9
rfind(s, RegExp("f"));    // no match, returns -1

Meta