test_patterns(
'This is some text -- with punctuation.',
[('[a-z]+', 'sequences of lowercase letters'),
('[A-Z]+', 'sequences of uppercase letters'),
('[a-zA-Z]+', 'sequences of letters of either case'),
('[A-Z][a-z]+', 'one uppercase followed by lowercase')],
)
结果输出如下:
'[a-z]+' (sequences of lowercase letters)
'This is some text -- with punctuation.'
.'his'
.....'is'
........'some'
.............'text'
.....................'with'
..........................'punctuation'
'[A-Z]+' (sequences of uppercase letters)
'This is some text -- with punctuation.'
'T'
'[a-zA-Z]+' (sequences of letters of either case)
'This is some text -- with punctuation.'
'This'
.....'is'
........'some'
.............'text'
.....................'with'
..........................'punctuation'
'[A-Z][a-z]+' (one uppercase followed by lowercase)
'This is some text -- with punctuation.'
'This'
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值.