Olá, estou tentando executar:
import re
padrao = "\w{5,50}@\w{3,10}.\w{2,3}.\w(2,3}"
texto = "meu nome é Rodrigo, meu e-mail rodrigo123@gmail.com.br"
resposta = re.search(padrao, texto)
print(resposta.group())
Está me dando esse erro:
Traceback (most recent call last):
File "C:\Users\Cas\PycharmProjects\python_brasilidades\main.py", line 5, in <module>
resposta = re.search(padrao, texto)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\re.py", line 200, in search
return _compile(pattern, flags).search(string)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\re.py", line 303, in _compile
p = sre_compile.compile(pattern, flags)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\sre_compile.py", line 788, in compile
p = sre_parse.parse(p, flags)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\sre_parse.py", line 955, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\sre_parse.py", line 444, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\sre_parse.py", line 843, in _parse
raise source.error("missing ), unterminated subpattern",
re.error: missing ), unterminated subpattern at position 28
Não consegui encontrar o erro.