Python Pandas column regex extract substring to end of line (\n or \r) in multil-line string
Using str.extract
in multiline mode should work here:
df["value"] = df["col"].str.extract(r'^(WHATIWANT:.*?)\s*$', flags=re.M)
Using str.extract
in multiline mode should work here:
df["value"] = df["col"].str.extract(r'^(WHATIWANT:.*?)\s*$', flags=re.M)