Categories
Python

Regex Extract Python

import re
s = """
... some line abc
... some other line
... name my_user_name is valid
... some more lines"""
p = re.compile("name (.*) is valid")
result = p.search(s)
print(result.group(1))