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


Python regex.DOTALL属性代码示例

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


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

示例1: regex_search

# 需要导入模块: import regex [as 别名]
# 或者: from regex import DOTALL [as 别名]
def regex_search(
        self,
        pattern: str,
        ignore_case: bool = False,
        multiline: bool = False,
        dotall: bool = False,
        unicode: bool = False,
        extended: bool = False,
    ):
        """Regex search on current data
        
        Args:
            pattern (str): Required. The regex pattern to search by
            ignore_case (bool, optional): Set case insentive flag. Defaults to False.
            multiline (bool, optional): ^/$ match start/end. Defaults to False.
            dotall (bool, optional): `.` matches newline. Defaults to False.
            unicode (bool, optional): Match unicode characters. Defaults to False.
            extended (bool, optional): Ignore whitespace. Defaults to False.
        
        Returns:
            Chepy: The Chepy object.

        Examples:
            >>> c = Chepy("loLolololoL")
            >>> c.regex_search("ol", ignore_case=True)
        """
        flags = 0
        if ignore_case:
            flags += re.IGNORECASE
        if multiline:
            flags += re.MULTILINE
        if dotall:
            flags += re.DOTALL
        if unicode:
            flags += re.UNICODE
        if extended:
            flags += re.X
        self.state = re.findall(pattern, self._convert_to_str(), flags=flags)
        return self 
开发者ID:securisec,项目名称:chepy,代码行数:41,代码来源:utils.py

示例2: setup_parser

# 需要导入模块: import regex [as 别名]
# 或者: from regex import DOTALL [as 别名]
def setup_parser():
        from lexnlp.extract.en.amounts import CURRENCY_SYMBOL_MAP
        symbols = '|'.join([k for k in CURRENCY_SYMBOL_MAP]).replace('$', r'\$')
        ParsedTextCorrector.PATTERN_MONEY_BREAK = ParsedTextCorrector.PATTERN_MONEY_BREAK.format(symbols=symbols)
        ParsedTextCorrector.REGEX_MONEY_BREAK = re.compile(
            ParsedTextCorrector.PATTERN_MONEY_BREAK,
            re.IGNORECASE | re.DOTALL | re.MULTILINE | re.VERBOSE | re.UNICODE) 
开发者ID:LexPredict,项目名称:lexpredict-contraxsuite,代码行数:9,代码来源:parsed_text_corrector.py

示例3: _buildRegexPatterns

# 需要导入模块: import regex [as 别名]
# 或者: from regex import DOTALL [as 别名]
def _buildRegexPatterns(cls):
        regexstr = b''
        for (fileHeader, fileTrailer) in cls.signatures:   
            if fileTrailer is None:
                regexstr += b'(%s.*)|' % (fileHeader,)
            else:
                regexstr += b'(%s.*?%s)|' % (fileHeader, fileTrailer)
       
        cls._regex = re.compile(regexstr[:-1], re.DOTALL) 
开发者ID:vikwin,项目名称:pcapfex,代码行数:11,代码来源:DataRecognizer.py


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