当前位置: 首页>>代码示例>>Python>>正文


Python regex.fullmatch方法代码示例

本文整理汇总了Python中regex.fullmatch方法的典型用法代码示例。如果您正苦于以下问题:Python regex.fullmatch方法的具体用法?Python regex.fullmatch怎么用?Python regex.fullmatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在regex的用法示例。


在下文中一共展示了regex.fullmatch方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import regex [as 别名]
# 或者: from regex import fullmatch [as 别名]
def __init__(
        self,
        string: Union[str, MutableSequence[str]],
        pattern: str,
        _match: Match = None,
        _type_to_spans: Dict[str, List[List[int]]] = None,
        _span: List[int] = None,
        _type: str = None,
    ) -> None:
        super().__init__(string, _type_to_spans, _span, _type)
        self.pattern = pattern
        if _match:
            self._match_cache = _match, self.string
        else:
            self._match_cache = fullmatch(
                LIST_PATTERN_FORMAT.replace(
                    b'{pattern}', pattern.encode(), 1),
                self._shadow,
                MULTILINE,
            ), self.string 
开发者ID:5j9,项目名称:wikitextparser,代码行数:22,代码来源:_wikilist.py

示例2: is_url

# 需要导入模块: import regex [as 别名]
# 或者: from regex import fullmatch [as 别名]
def is_url(string):
    # pattern adapted from CleverCSV
    pattern = "((https?|ftp):\/\/(?!\-))?(((([\p{L}\p{N}]*[\-\_]?[\p{L}\p{N}]+)+\.)+([a-z]{2,}|local)(\.[a-z]{2,3})?)|localhost|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:\d{1,5})?))(\/[\p{L}\p{N}_\/()~?=&%\-\#\.:+]*)?(\.[a-z]+)?"
    string = string.strip(" ")
    match = regex.fullmatch(pattern, string)
    return match is not None 
开发者ID:GjjvdBurg,项目名称:paper2remarkable,代码行数:8,代码来源:utils.py

示例3:

# 需要导入模块: import regex [as 别名]
# 或者: from regex import fullmatch [as 别名]
def getmatchingவிதிகள்(நிலைமொழி, வருமொழி):
    தொடர்மொழி_விதிகள் =[]
    நிலைமொழிவிரி = எழுத்து.உயிர்மெய்விரி(நிலைமொழி)
    வருமொழிவிரி  = எழுத்து.உயிர்மெய்விரி(வருமொழி)

    for விதி in விதிகள்:
        if regex.fullmatch(விதி.நிலைமொழி_regex, நிலைமொழிவிரி ) and \
             regex.fullmatch(விதி.வருமொழி_regex, வருமொழிவிரி ):
             தொடர்மொழி_விதிகள்.append(விதி)

    # print(தொடர்மொழி_விதிகள்)
    return தொடர்மொழி_விதிகள் 
开发者ID:srix,项目名称:pytamil,代码行数:14,代码来源:புணர்ச்சி.py

示例4: _match

# 需要导入模块: import regex [as 别名]
# 或者: from regex import fullmatch [as 别名]
def _match(self):
        """Return the match object for the current list."""
        cache_match, cache_string = self._match_cache
        string = self.string
        if cache_string == string:
            return cache_match
        cache_match = fullmatch(
            LIST_PATTERN_FORMAT.replace(
                b'{pattern}', self.pattern.encode(), 1),
            self._shadow,
            MULTILINE)
        self._match_cache = cache_match, string
        return cache_match 
开发者ID:5j9,项目名称:wikitextparser,代码行数:15,代码来源:_wikilist.py

示例5: is_elementary

# 需要导入模块: import regex [as 别名]
# 或者: from regex import fullmatch [as 别名]
def is_elementary(cell):
    return not (
        regex.fullmatch("[a-zA-Z0-9\.\_\&\-\@\+\%\(\)\ \/]+", cell) is None
    ) 
开发者ID:alan-turing-institute,项目名称:CleverCSV,代码行数:6,代码来源:normal_form.py

示例6: __search_node

# 需要导入模块: import regex [as 别名]
# 或者: from regex import fullmatch [as 别名]
def __search_node(self, current_node, fullpath, search_method=False, result=None):
        if result is None:
            result = []
        try:
            if regex.match(r"ns=\d*;[isgb]=.*", fullpath, regex.IGNORECASE):
                if self.__show_map:
                    log.debug("Looking for node with config")
                node = self.client.get_node(fullpath)
                if node is None:
                    log.warning("NODE NOT FOUND - using configuration %s", fullpath)
                else:
                    log.debug("Found in %s", node)
                    result.append(node)
            else:
                fullpath_pattern = regex.compile(fullpath)
                for child_node in current_node.get_children():
                    new_node = self.client.get_node(child_node)
                    new_node_path = '\\\\.'.join(char.split(":")[1] for char in new_node.get_path(200000, True))
                    if self.__show_map:
                        log.debug("SHOW MAP: Current node path: %s", new_node_path)
                    new_node_class = new_node.get_node_class()
                    regex_fullmatch = regex.fullmatch(fullpath_pattern, new_node_path.replace('\\\\.', '.')) or \
                                      new_node_path.replace('\\\\', '\\') == fullpath.replace('\\\\', '\\') or \
                                      new_node_path.replace('\\\\', '\\') == fullpath
                    regex_search = fullpath_pattern.fullmatch(new_node_path.replace('\\\\.', '.'), partial=True) or \
                                      new_node_path.replace('\\\\', '\\') in fullpath.replace('\\\\', '\\')
                    if regex_fullmatch:
                        if self.__show_map:
                            log.debug("SHOW MAP: Current node path: %s - NODE FOUND", new_node_path.replace('\\\\', '\\'))
                        result.append(new_node)
                    elif regex_search:
                        if self.__show_map:
                            log.debug("SHOW MAP: Current node path: %s - NODE FOUND", new_node_path)
                        if new_node_class == ua.NodeClass.Object:
                            if self.__show_map:
                                log.debug("SHOW MAP: Search in %s", new_node_path)
                            self.__search_node(new_node, fullpath, result=result)
                        elif new_node_class == ua.NodeClass.Variable:
                            log.debug("Found in %s", new_node_path)
                            result.append(new_node)
                        elif new_node_class == ua.NodeClass.Method and search_method:
                            log.debug("Found in %s", new_node_path)
                            result.append(new_node)
        except CancelledError:
            log.error("Request during search has been canceled by the OPC-UA server.")
        except BrokenPipeError:
            log.error("Broken Pipe. Connection lost.")
        except OSError:
            log.debug("Stop on scanning.")
        except Exception as e:
            log.exception(e) 
开发者ID:thingsboard,项目名称:thingsboard-gateway,代码行数:53,代码来源:opcua_connector.py


注:本文中的regex.fullmatch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。