Get the number of matches for the searched text.
511439
def get_number_matches(self, pattern, source_text='', case=False,
                           regexp=False):
        """"""
        pattern = to_text_string(pattern)
        if not pattern:
            return 0

        if not regexp:
            pattern = re.escape(pattern)

        if not source_text:
            source_text = to_text_string(self.toPlainText())

        try:
            if case:
                regobj = re.compile(pattern)
            else:
                regobj = re.compile(pattern, re.IGNORECASE)
        except sre_constants.error:
            return None

        number_matches = 0
        for match in regobj.finditer(source_text):
            number_matches += 1

        return number_matches
43857
def _search(self, trie, strings, limit=None):
        
        results = [trie.has_keys_with_prefix(s) for s in strings]
        if not any(results):
            return []
        for result, s in zip(results, strings):
            if result is True:
                return trie.values(s)[:limit]
499217
def search(self, pattern, count=None):
        
        return self._scan(match=pattern, count=count)
1363595
@Override
    public int matches(Replaceable text,
            int[] offset,
            int limit,
            boolean incremental) {

        if (offset[0] == limit) {
            // Strings, if any, have length != 0, so we don't worry
            // about them here.  If we ever allow zero-length strings
            // we much check for them here.
            if (contains(UnicodeMatcher.ETHER)) {
                return incremental ? U_PARTIAL_MATCH : U_MATCH;
            } else {
                return U_MISMATCH;
            }
        } else {
            if (strings.size() != 0) { // try strings first

                // might separate forward and backward loops later
                // for now they are combined

                // TODO Improve efficiency of this, at least in the forward
                // direction, if not in both.  In the forward direction we
                // can assume the strings are sorted.

                boolean forward = offset[0] < limit;

                // firstChar is the leftmost char to match in the
                // forward direction or the rightmost char to match in
                // the reverse direction.
                char firstChar = text.charAt(offset[0]);

                // If there are multiple strings that can match we
                // return the longest match.
                int highWaterLength = 0;

                for (String trial : strings) {
                    //if (trial.length() == 0) {
                    //    return U_MATCH; // null-string always matches
                    //}
                    // assert(trial.length() != 0); // We ensure this elsewhere

                    char c = trial.charAt(forward ? 0 : trial.length() - 1);

                    // Strings are sorted, so we can optimize in the
                    // forward direction.
                    if (forward && c > firstChar) break;
                    if (c != firstChar) continue;

                    int length = matchRest(text, offset[0], limit, trial);

                    if (incremental) {
                        int maxLen = forward ? limit-offset[0] : offset[0]-limit;
                        if (length == maxLen) {
                            // We have successfully matched but only up to limit.
                            return U_PARTIAL_MATCH;
                        }
                    }

                    if (length == trial.length()) {
                        // We have successfully matched the whole string.
                        if (length > highWaterLength) {
                            highWaterLength = length;
                        }
                        // In the forward direction we know strings
                        // are sorted so we can bail early.
                        if (forward && length < highWaterLength) {
                            break;
                        }
                        continue;
                    }
                }

                // We've checked all strings without a partial match.
                // If we have full matches, return the longest one.
                if (highWaterLength != 0) {
                    offset[0] += forward ? highWaterLength : -highWaterLength;
                    return U_MATCH;
                }
            }
            return super.matches(text, offset, limit, incremental);
        }
    }
942007
def search(self, text, lookup=None):
        '''
'''
        q = self._clone()
        q.text = (text, lookup)
        return q
947607
public static function countWords(string $text): int
    {
        // split text by ' ',\r,\n,\f,\t
        $split_array = preg_split('/\s+/', $text);
        // count matches that contain alphanumerics
        $word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array);

        return count($word_count);
    }
194499
public static int getLineCount(final String text) {
    final Matcher matcher = LINE_FINDER.matcher(text);
    int i = 0;

    while (matcher.find()) {
      i++;
    }

    return i;
  }
468800
def Search(self, text):
    """"""
    if isinstance(text, rdfvalue.RDFString):
      text = str(text)

    return self._regex.search(text)
569014
async function searchText(node, callback, query, limit) {
	  var cursor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
	  var desc = arguments[5];

	  var seen = {};
	  console.log('cursor', cursor, 'query', query, 'desc', desc);
	  var q = desc ? { '<': cursor, '-': desc } : { '>': cursor, '-': desc };
	  node.get({ '.': q, '%': 20 * 1000 }).once().map().on(function (value, key) {
	    console.log('searchText', value, key);
	    if (key.indexOf(query) === 0) {
	      if (typeof limit === 'number' && _Object$keys(seen).length >= limit) {
	        return;
	      }
	      if (seen.hasOwnProperty(key)) {
	        return;
	      }
	      if (value && _Object$keys(value).length > 1) {
	        seen[key] = true;
	        callback({ value: value, key: key });
	      }
	    }
	  });
	}
1060834
def get_match_number(self, pattern, case=False, regexp=False):
        """"""
        position = self.textCursor().position()
        source_text = self.get_text(position_from='sof', position_to=position)
        match_number = self.get_number_matches(pattern,
                                               source_text=source_text,
                                               case=case, regexp=regexp)
        return match_number
1183862
def get_amount_of_tweets(self):
        

        if not self.__response:
            raise TwitterSearchException(1013)

        return (len(self.__response['content']['statuses'])
                if self.__order_is_search
                else len(self.__response['content']))
1144824
public static int count(Pattern pattern, CharSequence content) {
		if (null == pattern || null == content) {
			return 0;
		}

		int count = 0;
		final Matcher matcher = pattern.matcher(content);
		while (matcher.find()) {
			count++;
		}

		return count;
	}
316420
public List<String> matchAll(String text, int limit) {
		return matchAll(text, limit, false, false);
	}
787530
def search_by_re_list(re_list, text):
    
    for matcher in re_list:
        m = matcher.search(text)
        if m:
            return m.groupdict()
    return None
963939
def change_number_matches(self, current_match=0, total_matches=0):
        """"""
        if current_match and total_matches:
            matches_string = u"{} {} {}".format(current_match, _(u"of"),
                                               total_matches)
            self.number_matches_text.setText(matches_string)
        elif total_matches:
            matches_string = u"{} {}".format(total_matches, _(u"matches"))
            self.number_matches_text.setText(matches_string)
        else:
            self.number_matches_text.setText(_(u"no matches"))
258157
def CountHuntResults(self, hunt_id, with_tag=None, with_type=None):
    """"""
    return len(
        self.ReadHuntResults(
            hunt_id, 0, sys.maxsize, with_tag=with_tag, with_type=with_type))
490223
def r_get_numbers(matchgroup, num):
    """"""
    res = []
    for i in range(num):
        res.append(float(matchgroup.next().group()))
    return np.array(res)