Skip to main content

Hi, i am using filters to extract words after the word “from” in an email SUBJECT line. The python I am using is not working...does anyone know python well and able to help?

 

Here’s what I am using

 

import re

text = "Import data from file.txt"
match = re.search(r'from\s+(\w+)', text, re.IGNORECASE)

if match:
    captured_word = match.group(1)
    print(captured_word)
else:
    print("No match found")

 

Thanks ahead of time for your help!

i tried this too:

 

import re

subject_line = "Re: Important Update from Marketing Team"

match = re.search(r'from\s+(.+)', subject_line, re.IGNORECASE)

if match:
    captured_text = match.group(1)
    print(captured_text)
else:
    print("No match found")

 


Hi @JLBroder 

Good question.

Perhaps you can outline a specific example of what you are trying to achieve with the data inputs and data outputs, regardless of the Python Code.

Screenshots are helpful.


i ended up just using the text separator function and was able to achieve it. thanks!