Ref<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex) { auto result = JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>::create(); auto regex = ContentSearchUtilities::createSearchRegex(query, caseSensitive, isRegex); for (const auto& match : getRegularExpressionMatchesByLines(regex, text)) result->addItem(buildObjectForSearchMatch(match.first, match.second)); return result; }
PassRefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex) { RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::GenericTypes::SearchMatch>> result = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::GenericTypes::SearchMatch>::create(); RegularExpression regex = ContentSearchUtils::createSearchRegex(query, caseSensitive, isRegex); Vector<std::pair<int, String>> matches = getRegularExpressionMatchesByLines(regex, text); for (Vector<std::pair<int, String>>::const_iterator it = matches.begin(); it != matches.end(); ++it) result->addItem(buildObjectForSearchMatch(it->first, it->second)); return result; }