本文整理汇总了Python中RegExpBuilder.RegExpBuilder.end方法的典型用法代码示例。如果您正苦于以下问题:Python RegExpBuilder.end方法的具体用法?Python RegExpBuilder.end怎么用?Python RegExpBuilder.end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RegExpBuilder.RegExpBuilder
的用法示例。
在下文中一共展示了RegExpBuilder.end方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_end
# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import end [as 别名]
def test_end(self):
regex = RegExpBuilder()
regex.exactly(1).of("p")
regex.end()
regex = regex.getRegExp()
self.assertTrue(regex.match("p") is not None)
self.assertTrue(regex.match("pq") is None)
示例2: test_ofAny
# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import end [as 别名]
def test_ofAny(self):
regex = RegExpBuilder()
regex.start()
regex.exactly(3).ofAny()
regex.end()
regex = regex.getRegExp()
self.assertTrue(regex.match("pqr") is not None)
示例3: test_of
# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import end [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)
示例4: test_notFromClass
# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import end [as 别名]
def test_notFromClass(self):
someLetters = ["p", "q", "r"]
regex = RegExpBuilder()
regex.start()
regex.exactly(3).notFromClass(someLetters)
regex.end()
regex = regex.getRegExp()
self.assertTrue(regex.match("lmn") is not None)
self.assertTrue(regex.match("mnq") is None)
示例5: test_ofGroup
# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import end [as 别名]
def test_ofGroup(self):
regex = RegExpBuilder()
regex.start()
regex.exactly(3).of("p").asGroup()
regex.exactly(1).of("q")
regex.exactly(1).ofGroup(1)
regex.end()
regex = regex.getRegExp()
self.assertTrue(regex.match("pppqppp") is not None)
示例6: test_like
# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import end [as 别名]
def test_like(self):
pattern = lambda r: r.min(1).of("p").min(2).of("q")
regex = RegExpBuilder()
regex.start()
regex.exactly(2).like(pattern)
regex.end()
regex = regex.getRegExp()
self.assertTrue(regex.match("pqqpqq") is not None)
self.assertTrue(regex.match("qppqpp") is None)
示例7: test_eitherLike_orLike
# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import end [as 别名]
def test_eitherLike_orLike(self):
regex = RegExpBuilder()
regex.start()
regex.eitherLike(lambda r: r.exactly(1).of("p"))
regex.orLike(lambda r: r.exactly(2).of("q"))
regex.end()
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)
示例8: test_fromClass
# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import end [as 别名]
def test_fromClass(self):
someLetters = ["p", "q", "r"]
regex = RegExpBuilder()
regex.start()
regex.exactly(3).fromClass(someLetters)
regex.end()
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)
示例9: test_min_max
# 需要导入模块: from RegExpBuilder import RegExpBuilder [as 别名]
# 或者: from RegExpBuilder.RegExpBuilder import end [as 别名]
def test_min_max(self):
regex = RegExpBuilder()
regex.start()
regex.min(3).max(7).of("p")
regex.end()
regex = regex.getRegExp()
self.assertTrue(regex.match("ppp") is not None)
self.assertTrue(regex.match("ppppp") is not None)
self.assertTrue(regex.match("ppppppp") is not None)
self.assertTrue(regex.match("pp") is None)
self.assertTrue(regex.match("p") is None)
self.assertTrue(regex.match("pppppppp") is None)
self.assertTrue(regex.match("pppppppppppp") is None)