1 Oct
2019
1 Oct
'19
2:44 a.m.
Hello Compiled regular expression objects have 13 attributes 12 are documented |Pattern.||search, | ||Pattern.||match,|||| |||Pattern.||fullmatch||| |||.... ||||Pattern.||pattern| |||||| But one is not |Pattern.||scanner| | | |Here|: https://docs.python.org/3.8/library/re.html Example: tokens = [ r'(?P<NUMBER>\d+)', r'(?P<PLUS>\+)', r'(?P<MINUS>-)', r'(?P<TIMES>\*)', r'(?P<DIVIDE>/)', r'(?P<WS>\s+)'] lex = re.compile('|'.join(tokens)) scan = lex.scanner(text) Regards JM Allard