Return the text content of @selector.

        Filter text content by @regex and @group.
182533
def get_filtered_values_by_selector(self, selector, regex=None, group=1):
        
        data = [
            self.get_text_from_node(node, regex, group)
            for node in self.get_nodes_by_selector(selector)
            if self.get_text_from_node(node, regex, group)
        ]

        return data if len(data) > 1 else data[0]
230696
def parse(self, text):
        ''''''
        tags, results = [], []

        text = self.re_tag.sub(lambda m: self.sub_tag(m, tags, results), text)

        if self.strict and tags:
            markup = "%s%s%s" % (self.tag_sep[0], tags.pop(0), self.tag_sep[1])
            raise MismatchedTag('opening tag "%s" has no corresponding closing tag' % markup)

        if self.always_reset:
            if not text.endswith(Style.RESET_ALL):
                text += Style.RESET_ALL

        return text
67491
def html(self, selector):
        

        result = self.__bs4.select(selector)

        return [str(r) for r in result] \
            if result.__len__() > 1 else \
            str(result[0]) if result.__len__() > 0 else None
952130
function(regex, text){
    var nextIndex = 0;
    var result = [];

    var execResult;
    while ((execResult = regex.exec(text))!== null) {
        result.push({
            start: execResult.index, 
            matchLength: execResult[0].length});
    }

    return {
        next: function(){
            return nextIndex < result.length ?
                result[nextIndex++] :
                null;
        }
    };
}
1156889
public static String extractRegexGroup(String fromContent, String regex) throws Exception {
        return extractRegexGroup(fromContent, regex, 1);
    }
894518
def _get_text(node, tag, default=None):
    """"""
    try:
        return node.find(tag).text
    except AttributeError:
        return default
906998
def t_TEXT(self, token):
        '
        text = token.lexer.lexmatch.group("text").decode("utf8")
        token.value = text
        return token
496348
function (selector) {
        if (typeof selector == 'function') {
          return DomQuery(grep(this.toArray(), function (item, i) {
            return selector(i, item);
          }));
        }

        return DomQuery(DomQuery.filter(selector, this.toArray()));
      }
232271
def _html(self, text):
        ''''''
        html = URL_REGEX.sub(self._parse_urls, text)
        html = USERNAME_REGEX.sub(self._parse_users, html)
        html = LIST_REGEX.sub(self._parse_lists, html)
        return HASHTAG_REGEX.sub(self._parse_tags, html)
267053
def cleaned_selector(html):
    
    import parsel
    try:
        tree = _cleaned_html_tree(html)
        sel = parsel.Selector(root=tree, type='html')
    except (lxml.etree.XMLSyntaxError,
            lxml.etree.ParseError,
            lxml.etree.ParserError,
            UnicodeEncodeError):
        # likely plain text
        sel = parsel.Selector(html)
    return sel
770640
def _filter(self, text):
        """"""

        if self.urls:
            text = RE_LINK.sub('', text)
        if self.emails:
            text = RE_MAIL.sub('', text)
        return text
442173
function _getElements( group, selector ) {
    if ( selector ) {
        if ( selector === 'form' ) {
            return [ formHtml ];
        }
        // e.g. if the widget selector starts at .question level (e.g. ".or-appearance-draw input")
        if ( group.classList.contains( 'question' ) ) {
            return [ ...group.querySelectorAll( 'input:not(.ignore), select:not(.ignore), textarea:not(.ignore)' ) ]
                .filter( el => el.matches( selector ) );
        }
        return [ ...group.querySelectorAll( selector ) ];
    }

    return [];
}
1182417
public function elementTextNotContains($selectorType, $selector, $text)
    {
        $element = $this->elementExists($selectorType, $selector);
        $actual = $element->getText();
        $regex = '/'.preg_quote($text, '/').'/ui';

        $message = sprintf(
            'The text "%s" appears in the text of the %s, but it should not.',
            $text,
            $this->getMatchingElementRepresentation($selectorType, $selector)
        );

        $this->assertElementText(!preg_match($regex, $actual), $message, $element);
    }
385977
def get_text(self, locator):
        
        text = self._get_text(locator)
        self._info("Element '%s' text is '%s' " % (locator, text))
        return text
475801
function getFilterFunc(selector, context) {
    function wordRegExpTester(name, prop) {
      var re = RegExp('(^|\\s+)' + name + '(?=$|\\s)', 'i');
      return function(obj) {return  name ? re.test(obj[prop]) : true;};
    }

    var nodeSet = {};
    var dotPos = nodeSet;
    if (isFunction(selector))
      return selector;
    else if (isNumber(selector))
      return function(v, index) { return index == selector; };
    else if (!selector || selector == '*' ||
             (isString(selector) && (dotPos = /^([\w-]*)\.?([\w-]*)$/.exec(selector)))) {
      var nodeNameFilter = wordRegExpTester(dotPos[1], 'tagName');
      var classNameFilter = wordRegExpTester(dotPos[2], 'className');
      return function(v) {
        return isNode(v) == 1 && nodeNameFilter(v) && classNameFilter(v);
      };
    }
    else if (context)
      return function(v) {
        return $(selector, context)['find'](v)!=_null; // live search instead of node set, for on()
      };
    else {
      $(selector)['each'](function(node) {
        nodeSet[getNodeId(node)] = true;
      });
      return function(v) {
        return nodeSet[getNodeId(v)];
      };
    }
  }
542643
def selector_to_text(sel, guess_punct_space=True, guess_layout=True):
    
    import parsel
    if isinstance(sel, parsel.SelectorList):
        # if selecting a specific xpath
        text = []
        for s in sel:
            extracted = etree_to_text(
                s.root,
                guess_punct_space=guess_punct_space,
                guess_layout=guess_layout)
            if extracted:
                text.append(extracted)
        return ' '.join(text)
    else:
        return etree_to_text(
            sel.root,
            guess_punct_space=guess_punct_space,
            guess_layout=guess_layout)
978876
function (selector) {
		var score = [0, 0, 0];
		var parts = selector.split(' ');
		var part;
		var match;

		//TODO: clean the ':not' part since the last ELEMENT_RE will pick it up
		while (part = parts.shift(), typeof part === 'string') {
			// find all pseudo-elements
			match = _find(part, PSEUDO_ELEMENTS_RE);
			score[2] = match;
			// and remove them
			match && (part = part.replace(PSEUDO_ELEMENTS_RE, ''));
			// find all pseudo-classes
			match = _find(part, PSEUDO_CLASSES_RE);
			score[1] = match;
			// and remove them
			match && (part = part.replace(PSEUDO_CLASSES_RE, ''));
			// find all attributes
			match = _find(part, ATTR_RE);
			score[1] += match;
			// and remove them
			match && (part = part.replace(ATTR_RE, ''));
			// find all IDs
			match = _find(part, ID_RE);
			score[0] = match;
			// and remove them
			match && (part = part.replace(ID_RE, ''));
			// find all classes
			match = _find(part, CLASS_RE);
			score[1] += match;
			// and remove them
			match && (part = part.replace(CLASS_RE, ''));
			// find all elements
			score[2] += _find(part, ELEMENT_RE);
		}

		return parseInt(score.join(''), 10);
	}