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


Python RegExpBuilder.match方法代码示例

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


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

示例1: test_orString

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
    def test_orString(self):
        regex = RegExpBuilder()
        regex.either(["p", "q"])
        regex = regex.get_regexp()

        self.assertTrue(regex.match("p") is not None)
        self.assertTrue(regex.match("q") is not None)
        self.assertTrue(regex.match("r") is None)
开发者ID:Kotrotsos,项目名称:RegExpBuilder,代码行数:10,代码来源:Tests.py

示例2: test_notAhead

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_notAhead(self):
     regex = RegExpBuilder()
     regex.exactly(1).of("dart")
     regex.notAhead(RegExpBuilder().exactly(1).of("pqr"))
     regex = regex.getRegExp()
     
     self.assertTrue(regex.match("dartlang") is not None)
     self.assertTrue(regex.match("dartpqr") is None)
开发者ID:agamia,项目名称:RegExpBuilder,代码行数:10,代码来源:Tests.py

示例3: test_startOfLine

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_startOfLine(self):
     regex = RegExpBuilder()
     regex.startOfLine()
     regex.exactly(1).of("p")
     regex = regex.getRegExp()
 
     self.assertTrue(regex.match("p") is not None)
     self.assertTrue(regex.match("qp") is None)
开发者ID:agamia,项目名称:RegExpBuilder,代码行数:10,代码来源:Tests.py

示例4: test_end_of_line

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_end_of_line(self):
     regex = RegExpBuilder()
     regex.exactly(1).of("p")
     regex.end_of_line()
     regex = regex.get_regexp()
     
     self.assertTrue(regex.match("p") is not None)
     self.assertTrue(regex.match("pq") is None)
开发者ID:Kotrotsos,项目名称:RegExpBuilder,代码行数:10,代码来源:Tests.py

示例5: test_ahead

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_ahead(self):
     regex = RegExpBuilder()
     regex.exactly(1).of("dart")
     regex.ahead(RegExpBuilder().exactly(1).of("lang"))
     regex = regex.getRegExp()
     
     self.assertTrue(regex.match("dartlang").group() == "dart")
     self.assertTrue(regex.match("dartpqr") is None)
开发者ID:agamia,项目名称:RegExpBuilder,代码行数:10,代码来源:Tests.py

示例6: test_of

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_of(self):
     regex = RegExpBuilder()
     regex.start()
     regex.exactly(2).of("p p p ")
     regex.end()
     regex = regex.getRegExp()
     
     self.assertTrue(regex.match("p p p p p p ") is not None)
     self.assertTrue(regex.match("p p p p pp") is None)
开发者ID:AliXX,项目名称:RegExpBuilder,代码行数:11,代码来源:Tests.py

示例7: test_min

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_min(self):
     regex = RegExpBuilder()
     regex.startOfLine()
     regex.min(2).of("p")
     regex.endOfLine()
     regex = regex.getRegExp()
     
     self.assertTrue(regex.match("pp") is not None)
     self.assertTrue(regex.match("ppp") is not None)
     self.assertTrue(regex.match("ppppppp") is not None)
     self.assertTrue(regex.match("p") is None)
开发者ID:agamia,项目名称:RegExpBuilder,代码行数:13,代码来源:Tests.py

示例8: test_orLike_chain

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
    def test_orLike_chain(self):
        regex = RegExpBuilder()
        regex.eitherLike(RegExpBuilder().exactly(1).of("p"))
        regex.orLike(RegExpBuilder().exactly(1).of("q"))
        regex.orLike(RegExpBuilder().exactly(1).of("r"))
        regex = regex.getRegExp()

        self.assertTrue(regex.match("p") is not None)
        self.assertTrue(regex.match("q") is not None)
        self.assertTrue(regex.match("r") is not None)
        self.assertTrue(regex.match("s") is None)
开发者ID:agamia,项目名称:RegExpBuilder,代码行数:13,代码来源:Tests.py

示例9: test_eitherLike_orLike

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_eitherLike_orLike(self):
     regex = RegExpBuilder()
     regex.startOfLine()
     regex.eitherLike(RegExpBuilder().exactly(1).of("p"))
     regex.orLike(RegExpBuilder().exactly(2).of("q"))
     regex.endOfLine()
     regex = regex.getRegExp()
     
     self.assertTrue(regex.match("p") is not None)
     self.assertTrue(regex.match("qq") is not None)
     self.assertTrue(regex.match("pqq") is None)
     self.assertTrue(regex.match("qqp") is None)
开发者ID:agamia,项目名称:RegExpBuilder,代码行数:14,代码来源:Tests.py

示例10: test_orLike_chain

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
    def test_orLike_chain(self):
        p1 = RegExpBuilder().exactly(1).of("p")
        p2 = RegExpBuilder().exactly(1).of("q")
        p3 = RegExpBuilder().exactly(1).of("r")
        regex = RegExpBuilder()
        regex.either([p1, p2, p3])
        regex = regex.get_regexp()

        self.assertTrue(regex.match("p") is not None)
        self.assertTrue(regex.match("q") is not None)
        self.assertTrue(regex.match("r") is not None)
        self.assertTrue(regex.match("s") is None)
开发者ID:Kotrotsos,项目名称:RegExpBuilder,代码行数:14,代码来源:Tests.py

示例11: test_max

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_max(self):
     regex = RegExpBuilder()
     regex.start_of_line()
     regex.max(3).of("p")
     regex.end_of_line()
     regex = regex.get_regexp()
     
     self.assertTrue(regex.match("p") is not None)
     self.assertTrue(regex.match("pp") is not None)
     self.assertTrue(regex.match("ppp") is not None)
     self.assertTrue(regex.match("pppp") is None)
     self.assertTrue(regex.match("pppppppp") is None)
开发者ID:Kotrotsos,项目名称:RegExpBuilder,代码行数:14,代码来源:Tests.py

示例12: test_eitherLike_orLike

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_eitherLike_orLike(self):
     p1 = RegExpBuilder().exactly(1).of("p")
     p2 = RegExpBuilder().exactly(2).of("q")
     regex = RegExpBuilder()
     regex.start_of_line()
     regex.either([p1, p2])
     regex.end_of_line()
     regex = regex.get_regexp()
     
     self.assertTrue(regex.match("p") is not None)
     self.assertTrue(regex.match("qq") is not None)
     self.assertTrue(regex.match("pqq") is None)
     self.assertTrue(regex.match("qqp") is None)
开发者ID:Kotrotsos,项目名称:RegExpBuilder,代码行数:15,代码来源:Tests.py

示例13: test_fromClass

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_fromClass(self):
     someLetters = ["p", "q", "r"]
     regex = RegExpBuilder()
     regex.startOfLine()
     regex.exactly(3).fromClass(someLetters)
     regex.endOfLine()
     regex = regex.getRegExp()
     
     self.assertTrue(regex.match("ppp") is not None)
     self.assertTrue(regex.match("qqq") is not None)
     self.assertTrue(regex.match("ppq") is not None)
     self.assertTrue(regex.match("rqp") is not None)
     self.assertTrue(regex.match("pyy") is None)
开发者ID:agamia,项目名称:RegExpBuilder,代码行数:15,代码来源:Tests.py

示例14: test_asGroup

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_asGroup(self):
     regex = RegExpBuilder()
     regex.min(1).max(3).of("p")
     regex.exactly(1).of("dart").asGroup()
     regex.exactly(1).fromClass(["p", "q", "r"])
     regex = regex.getRegExp()
     
     self.assertTrue(regex.match("pdartq").group(1) == "dart")
开发者ID:agamia,项目名称:RegExpBuilder,代码行数:10,代码来源:Tests.py

示例15: test_reluctantly

# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import match [as 别名]
 def test_reluctantly(self):
     regex = RegExpBuilder()
     regex.exactly(2).of("p")
     regex.min(2).ofAny().reluctantly()
     regex.exactly(2).of("p")
     regex = regex.getRegExp()
     
     self.assertTrue(regex.match("pprrrrpprrpp").group() == "pprrrrpp")
开发者ID:agamia,项目名称:RegExpBuilder,代码行数:10,代码来源:Tests.py


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