LeoSam
LeoSam

Reputation: 4941

Regex pattern to strip off certain lines

im handling emails through email handler , i need to strip off 2 things in each email Incoming

  1. stripping off any words start with BF00 usually it will be one word
  2. strip off few lines at body message , lines start with this email including and end Thanks for you cooprate between these need to bed stripped off

I used

\n this email including \n.* 

and

^\w+

did not help

any tips

Upvotes: 0

Views: 64

Answers (1)

Avinash Raj
Avinash Raj

Reputation: 174706

Use the below pattern to match the strings you want to remove.

\bBF00\S*|(?:this\s*email\s*including).*?(?:Thanks\s*for\s*you\s*cooprate)

DEMO

Upvotes: 1

Related Questions