regExIndexOf1 function

int regExIndexOf1(
  1. String pattern,
  2. String source
)

Implementation

int regExIndexOf1(String pattern, String source) {
  var rgx = RegExp(pattern);
  var first = rgx.firstMatch(source);
  if (first == null) //
    return -1;

  return first.start;
}