 
 @inline(never)
 public func run_StringMatch(_ N: Int) {
-  for _ in 1...N*100 {
+  for _ in 1...N {
     for (regex, text) in tests {
       _ = match(regexp: regex,text: text)
     }
   }
 }
-

public let StringMatch = BenchmarkInfo(
  name: "StringMatch",
  runFunction: run_StringMatch,
  tags: [.validation, .api, .String])

/* match: search for regexp anywhere in text */
func match(regexp: String, text: String) -> Bool {
  if regexp.first == "^" {
    return matchHere(regexp.dropFirst(), text[...])
  }
  
  var idx = text.startIndex
  while true {  // must look even if string is empty
    if matchHere(regexp[...], text[idx..<text.endIndex]) {

  if regexp.isEmpty {
    return true
  }

  if let c = regexp.first, regexp.dropFirst().first == "*" {
    return matchStar(c, regexp.dropFirst(2), text)
  }

  if regexp.first == "$" && regexp.dropFirst().isEmpty {
    return text.isEmpty
  }

  if let tc = text.first, let rc = regexp.first, rc == "." || tc == rc {
    return matchHere(regexp.dropFirst(), text.dropFirst())
  }

  return false
}

