Article From:https://www.cnblogs.com/huipengbo/p/9735017.html

1.Match common URL

^(http://)([a-z]+)\.([a-z]+)\.(com|cn|net|edu)(/(\w)+)+(.+)

2.Matches the type in the string returned by type

import re

re.match(r"^(<class )'([a-z|_]+)'>$","<class 'builtin_function_or_method'>")
Out[5]: <_sre.SRE_Match object; span=(0, 36), match="<class 'builtin_function_or_method'>">

m = re.match(r"^(<class )'([a-z|_]+)'>$","<class 'builtin_function_or_method'>")

m.group()
Out[7]: "<class 'builtin_function_or_method'>"

m.groups()
Out[8]: ('<class ', 'builtin_function_or_method')

m.groups(2)
Out[9]: ('<class ', 'builtin_function_or_method')

m.group(2)
Out[10]: 'builtin_function_or_method'

3.Match month

(^1[1-2])|(0?[1-9])

4.

 

Leave a Reply

Your email address will not be published. Required fields are marked *