I want to extract the lines between a keyword and a sentence from text data. Here is my data,
CUSTOMER SUPPLIED DATA:
- topic: Sign in & Password Support
- First Name: Brenda
- Last Name: Delacruz
- Account number: xxxxxxxxx
- U-verse 4-digit PIN: My PIN is
- 4 digit PIN: xxxx
- Email: deedelacruz28806@yahoo.com
- I need help with: Forgot password or ID
*** System::[chat.automatonClientOutcome] Hello! How may I help you today? *** System::[chat.queueWaitDisplayed] We are currently experiencing very high chat volumes which may cause long delays. An agent will be with you as soon as possible.
Here help me to extract the lines under the key word "CUSTOMER SUPPLIED DATA:", before * system line starts. (extract lines between CUSTOMER SUPPLIED DATA: and * System line).
I have tried the following code,
m = re.search('CUSTOMER SUPPLIED DATA:\s*([^\n]+)', dt["chat_consolidation"
[546])
m.group(1)
which gives me only a single line between CUSTOMER SUPPLIED DATA: and *** system line
The output is like this:
[out]: - topic: Sign in & Password Support
But my required output should be like this,
[Out]: - topic: Sign in & Password Support
- First Name: Brenda
- Last Name: Delacruz
- Account number: xxxxxxxxx
- U-verse 4-digit PIN: My PIN is
- 4 digit PIN: xxxx
- Email: deedelacruz28806@yahoo.com
- I need help with: Forgot password or ID
Thanks in advance for helping me.