Python Forum
Reg Xpression to remove a text
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reg Xpression to remove a text
#1
Hi,

I get this text in my output that I want to remove
Quote: NoErrorRE: [EXTERNAL] PL_192_01_28Claire Gravell SANTAMService EscalationNormal

I'm not sure how to write Regex to remove it.
Reply
#2
(May-13-2019, 11:14 AM)stahorse Wrote: I get this text in my output that I want to remove
Show more of text,input and wanted output.
Give it a try,dos matter at all if don't work just to show some effort,so it's just not i want a solution's post.
Reply
#3
I have a very long file, I wrote Regex to clean it, it's just that part that I don't know how to clean it. SO here's my file with my code below to clean it:

Quote:<GetItemResponse xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"><ResponseMessages><GetItemResponseMessage ResponseClass="Success"><ResponseCode>NoError</ResponseCode><Items><Message xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><ItemId ChangeKey="CQAAABYAAACCebESk9s/RJN4+Si70EJ7AACxDY4R" Id="AAMkADYzYjdkOGNjLTVlNmQtNDA4NC1iYjFiLTU4YTc3YzQxN2E3OABGAAAAAAApOnQOgWjCTrM4g5Qq5+FcBwCCebESk9s/RJN4+Si70EJ7AAAAWB/hAACCebESk9s/RJN4+Si70EJ7AACxDYYvAAA="/><Subject>RE: [EXTERNAL] PL_192_01_28Claire Gravell kingService Escalation</Subject><Sensitivity>Normal</Sensitivity><Body BodyType="HTML"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Minion Pro";}
@font-face
{font-family:inherit;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
h4
{mso-style-priority:9;
mso-style-link:"Heading 4 Char";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Calibri",sans-serif;}
h5
{mso-style-priority:9;
mso-style-link:"Heading 5 Char";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.Heading4Char
{mso-style-name:"Heading 4 Char";
mso-style-priority:9;
mso-style-link:"Heading 4";
font-family:"Calibri",sans-serif;
font-weight:bold;}
span.Heading5Char
{mso-style-name:"Heading 5 Char";
mso-style-priority:9;
mso-style-link:"Heading 5";
font-family:"Calibri",sans-serif;
font-weight:bold;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.3oh-
{mso-style-name:_3oh-;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1027" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-ZA" link="blue" vlink="purple">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
h4
{mso-style-priority:9;
mso-style-link:"Heading 4 Char";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Calibri",sans-serif;}
h5
{mso-style-priority:9;
mso-style-link:"Heading 5 Char";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.Heading4Char
{mso-style-name:"Heading 4 Char";
mso-style-priority:9;
mso-style-link:"Heading 4";
font-family:"Calibri",sans-serif;
font-weight:bold;}
span.Heading5Char
{mso-style-name:"Heading 5 Char";
mso-style-priority:9;
mso-style-link:"Heading 5";
font-family:"Calibri",sans-serif;
font-weight:bold;}
span.3oh-
{mso-style-name:_3oh-;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
<div class="WordSection1">
<p class="MsoNormal">Will do thanks</p>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">Almene Barends<br>
Content Publisher <br>
<br>
T. #43;27 (21) 469 1576 / M. #43;27 (81) 560 1784<br>
22 Lawley Road / Woodstock / Cape Town 7925<br>
<a href="https://protect-za.mimecast.com/s/DSa6CLg1K2TQxJv1tBdIzq?domain=kingjames.digital">kingjames.digital</a></p>
<p class="MsoNormal"><o:p></o:p></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Smn lt;Smn@King.co.zagt;<br>
<b>Sent:</b> Monday, January 28, 2019 12:37:13 PM<br>
<b>To:</b> Almene Barends; Smn; Michael Collocott; Marguerite De Villiers (king); Zanele Magazi (king)<br>
<b>Subject:</b> RE: [EXTERNAL] PL_192_01_28Claire Gravell kingService Escalation</font>
<div></div>
</div>
<div><br>
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US">Hi Almene,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US">We can confirm the policy had been cancelled on 25/01/2019<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US">Any premiums deducted will be refunded and the cancellation letter will be emailed to the client.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US">You may notify her of this and perhaps just confirm her email address as well?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US">Thank you.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="color:#1F497D">Kind Regards/Vriendelike Groete.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="color:#1F497D"><o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p></o:p></span></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr style="height:1.6pt">
<td width="186" rowspan="8" valign="top" style="width:7.0cm;padding:0cm 0cm 0cm 0cm;height:1.6pt">
<p class="MsoNormal" style="line-height:120%;text-autospace:none"><!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter" />
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0" />
<v:f eqn="sum @0 1 0" />
<v:f eqn="sum 0 0 @1" />
<v:f eqn="prod @2 1 2" />
<v:f eqn="prod @3 21600 pixelWidth" />
<v:f eqn="prod @3 21600 pixelHeight" />
<v:f eqn="sum @0 0 1" />
<v:f eqn="prod @6 1 2" />
<v:f eqn="prod @7 21600 pixelWidth" />
<v:f eqn="sum @8 21600 0" />
<v:f eqn="prod @7 21600 pixelHeight" />
<v:f eqn="sum @10 21600 0" />
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" />
<o:lock v:ext="edit" aspectratio="t" />
</v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_s1026" type="#_x0000_t75" alt="king_100_Years_Stacked Logo_English email signature-01" style='position:absolute;margin-left:0;margin-top:-.85pt;width:195.15pt;height:141.6pt;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-width-percent:0;mso-height-percent:0;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;mso-position-horizontal:absolute;mso-position-horizontal-relative:text;mso-position-vertical:absolute;mso-position-vertical-relative:text;mso-width-percent:0;mso-height-percent:0;mso-width-relative:margin;mso-height-relative:margin'>
<v:imagedata src="cid:[email protected]" o:title="king_100_Years_Stacked Logo_English email signature-01" />
</v:shape><![endif]--><![if !vml]><span style="mso-ignore:vglayout;position:relative;z-index:251659264"><span style="position:absolute;left:0px;top:-1px;width:260px;height:189px"><img width="260" height="189" style="width:2.7083in;height:1.9687in" alt="king_100_Years_Stacked Logo_English email signature-01" v:shapes="Picture_x0020_1" src="cid:[email protected]"></span></span><![endif]><b><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US"><o:p></o:p></span></b></p>
</td>
<td width="522" valign="top" style="width:499.45pt;padding:0cm 0cm 0cm 0cm;height:1.6pt">
<p class="MsoNormal" style="line-height:120%;text-autospace:none"><b><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">Stephan Olivier</span></b><span lang="EN-US" style="font-size:12.0pt;line-height:120%;font-family:quot;Minion Proquot;;color:black;mso-fareast-language:EN-US"><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:.85pt">
<td width="522" valign="top" style="width:499.45pt;padding:0cm 0cm 0cm 0cm;height:.85pt">
<p class="MsoNormal" style="line-height:120%;text-autospace:none"><b><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">Client Care Media Manager<o:p></o:p></span></b></p>
</td>
</tr>
<tr style="height:.85pt">
<td width="522" valign="top" style="width:499.45pt;padding:0cm 0cm 0cm 0cm;height:.85pt">
<p class="MsoNormal" style="line-height:120%;text-autospace:none"><b><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">Client Care/Kliente Diens<o:p></o:p></span></b></p>
</td>
</tr>
<tr style="height:.85pt">
<td width="522" valign="top" style="width:499.45pt;padding:0cm 0cm 0cm 0cm;height:.85pt">
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:.85pt">
<td width="522" valign="top" style="width:499.45pt;padding:0cm 0cm 0cm 0cm;height:.85pt">
<p class="MsoNormal" style="line-height:120%;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">T: #43;27 21915 7556
</span><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:#FFC520;mso-fareast-language:EN-US">|</span><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">
E: </span><u><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:blue;mso-fareast-language:EN-US"><a href="mailto:stephan.olivier@King.co.za"><span style="color:blue">stephan.olivier@King.co.za</span></a></span></u><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US"><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:.85pt">
<td width="522" valign="top" style="width:499.45pt;padding:0cm 0cm 0cm 0cm;height:.85pt">
<p class="MsoNormal" style="line-height:120%;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">king Head Office,1 Sportica crescent, Tygervalley, 7500
</span><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:#FFC520;mso-fareast-language:EN-US"><br>
</span><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US"><a href="https://protect-za.mimecast.com/s/K8QiCMjKL2hzKQlZskb0wZ?domain=protect-za.mimecast.com">www.king.co.za</a><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:.85pt">
<td width="522" valign="top" style="width:499.45pt;padding:0cm 0cm 0cm 0cm;height:.85pt">
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
</td>
</tr>
<tr style="height:.85pt">
<td width="522" valign="top" style="width:499.45pt;padding:0cm 0cm 0cm 0cm;height:.85pt">
<p class="MsoNormal" style="line-height:150%;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;line-height:150%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">Personal
</span><span lang="EN-US" style="font-size:10.0pt;line-height:150%;font-family:quot;Arialquot;,sans-serif;color:#FFC520;mso-fareast-language:EN-US">|
</span><span lang="EN-US" style="font-size:10.0pt;line-height:150%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">Commercial
</span><span lang="EN-US" style="font-size:10.0pt;line-height:150%;font-family:quot;Arialquot;,sans-serif;color:#FFC520;mso-fareast-language:EN-US">|
</span><span lang="EN-US" style="font-size:10.0pt;line-height:150%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">Specialist</span><span lang="EN-US" style="font-size:10.0pt;line-height:150%;font-family:quot;Arialquot;,sans-serif;color:#FFC520;mso-fareast-language:EN-US">
| </span><span lang="EN-US" style="font-size:10.0pt;line-height:150%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">Agriculture<o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:120%;text-autospace:none"><span lang="EN-US" style="font-size:7.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US">king is an authorised financial services provider (licence
number 3416).</span><span lang="EN-US" style="font-size:10.0pt;line-height:120%;font-family:quot;Arialquot;,sans-serif;color:black;mso-fareast-language:EN-US"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="color:#1F497D"><img border="0" width="626" height="78" style="width:6.5208in;height:.8125in" id="_x0000_i1026" alt="Top employer email banner" src="cid:[email protected]"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-US"><o:p></o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Almene Barends lt;[email protected];
<br>
<b>Sent:</b> 28 January 2019 12:04 PM<br>
<b>To:</b> Smn lt;Smn@King.co.zagt;; Michael Collocott lt;[email protected];; Marguerite De Villiers (king) lt;Marguerite.DeVilliers@King.co.zagt;; Zanele Magazi (king) lt;Zanele.Magazi@King.co.zagt;<br>
<b>Subject:</b> [EXTERNAL] PL_192_01_28Claire Gravell kingService Escalation<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">Hi team, please can you assist with this service escalation -client been repeatedly emailed us to cancel her policy<o:p></o:p></p>
<p class="MsoNormal">I have requested an email address, do we have another one on file as she is overseas<o:p></o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
<div>
<div>
<div>
<div>
<h4 align="center" style="mso-margin-top-alt:9.0pt;margin-right:0cm;margin-bottom:9.0pt;margin-left:15.0pt;text-align:center;background:white">
<span style="font-size:9.0pt;font-family:inherit;color:#90949C;text-transform:uppercase;font-weight:normal">THU 9:48 AM<o:p></o:p></span></h4>
</div>
</div>
</div>
<div style="margin-bottom:11.25pt;zoom: 1">
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:10.5pt;font-family:inherit;color:#1D2129"><img border="0" width="32" height="32" style="width:.3333in;height:.3333in" id="Picture_x0020_3" alt="Claire Gravell" src="cid:[email protected]"><o:p></o:p></span></p>
</div>
</div>
</div>
<div style="margin-left:27.0pt">
<div style="margin-top:.75pt;margin-bottom:.75pt;user-select: text;border-radius: 1.3em;max-width:55%;box-sizing: content-box;outline: none;overflow-wrap: break-word;float:left" id="js_ccj">
<div>
<p class="MsoNormal" style="background:#F1F0F0"><span class="3oh-"><span style="font-size:10.5pt;font-family:inherit;color:black">Good day, I have been emailing for three days to try and stop/cancel my policy as I have immigrated and the house has bee sold.
And every other department responds except for the one that actually NEEDS to do it! 90421050084</span></span><span style="font-size:10.5pt;font-family:inherit;color:black"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<h4 align="center" style="mso-margin-top-alt:9.0pt;margin-right:0cm;margin-bottom:9.0pt;margin-left:15.0pt;text-align:center;background:white">
<span style="font-size:9.0pt;font-family:inherit;color:#90949C;text-transform:uppercase;font-weight:normal">FRI 2:05 PM<o:p></o:p></span></h4>
</div>
</div>
</div>
<div style="margin-bottom:11.25pt;zoom: 1">
<div style="margin-left:27.0pt">
<h5 style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:.75pt;margin-left:0cm;background:white">
<span style="font-size:9.0pt;font-family:inherit;color:#1D2129;font-weight:normal">king Insurance<o:p></o:p></span></h5>
<div style="margin-top:.75pt;margin-bottom:.75pt;user-select: text;border-radius: 1.3em;max-width:55%;box-sizing: content-box;outline: none;overflow-wrap: break-word;float:right" id="js_cdq">
<div>
<p class="MsoNormal" style="background:#0084FF"><span class="3oh-"><span style="font-size:10.5pt;font-family:inherit;color:white">Hi Claire, thank you for bringing this to our attention. Please inbox us your email address too so to assist with this</span></span><span style="font-size:10.5pt;font-family:inherit;color:white"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">Almene Barends<br>
Content Publisher <br>
<br>
T. #43;27 (21) 469 1576 / M. #43;27 (81) 560 1784<br>
22 Lawley Road / Woodstock / Cape Town 7925<br>
<a href="https://protect-za.mimecast.com/s/p8sjCNxKM2hjK2RBSjlChn?domain=protect-za.mimecast.com">kingjames.digital</a><o:p></o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
</div>
<br>
The content of this email is confidential and intended for the addressee only. If it was sent to you in error, please notify the sender immediately and delete the email. king is by no means liable to any person for any loss or consequential damages arising
from the distribution or use of this email. Please follow this <a href="https://protect-za.mimecast.com/s/MCeACO7XN2cvV6GKIryCmS?domain=protect-za.mimecast.com" target="_blank">
link</a> for the terms of use of this communication. <br>
</div>
</body>
</html>
</Body><Attachments><FileAttachment><AttachmentId Id="AAMkADYzYjdkOGNjLTVlNmQtNDA4NC1iYjFiLTU4YTc3YzQxN2E3OABGAAAAAAApOnQOgWjCTrM4g5Qq5+FcBwCCebESk9s/RJN4+Si70EJ7AAAAWB/hAACCebESk9s/RJN4+Si70EJ7AACxDYYvAAABBgAEAAAAAAA="/><Name>image003.jpg</Name><ContentType>image/jpeg</ContentType><ContentId>[email protected]</ContentId><Size>7156</Size><LastModifiedTime>2019-01-28T10:37:13</LastModifiedTime><IsInline>true</IsInline><IsContactPhoto>false</IsContactPhoto></FileAttachment><FileAttachment><AttachmentId Id="AAMkADYzYjdkOGNjLTVlNmQtNDA4NC1iYjFiLTU4YTc3YzQxN2E3OABGAAAAAAApOnQOgWjCTrM4g5Qq5+FcBwCCebESk9s/RJN4+Si70EJ7AAAAWB/hAACCebESk9s/RJN4+Si70EJ7AACxDYYvAAABBgAEAAEAAAA="/><Name>image004.jpg</Name><ContentType>image/jpeg</ContentType><ContentId>[email protected]</ContentId><Size>9522</Size><LastModifiedTime>2019-01-28T10:37:13</LastModifiedTime><IsInline>true</IsInline><IsContactPhoto>false</IsContactPhoto></FileAttachment><FileAttachment><AttachmentId Id="AAMkADYzYjdkOGNjLTVlNmQtNDA4NC1iYjFiLTU4YTc3YzQxN2E3OABGAAAAAAApOnQOgWjCTrM4g5Qq5+FcBwCCebESk9s/RJN4+Si70EJ7AAAAWB/hAACCebESk9s/RJN4+Si70EJ7AACxDYYvAAABBgAEAAIAAAA="/><Name>image005.jpg</Name><ContentType>image/jpeg</ContentType><ContentId>[email protected]</ContentId><Size>1280</Size><LastModifiedTime>2019-01-28T10:37:13</LastModifiedTime><IsInline>true</IsInline><IsContactPhoto>false</IsContactPhoto></FileAttachment></Attachments><Size>39697</Size><DateTimeSent>2019-01-28T10:45:35Z</DateTimeSent><DateTimeCreated>2019-01-28T10:45:47Z</DateTimeCreated><ResponseObjects><ReplyToItem/><ReplyAllToItem/><ForwardItem/></ResponseObjects><HasAttachments>false</HasAttachments><IsAssociated>false</IsAssociated><ToRecipients><Mailbox><Name>Smn</Name><EmailAddress>Smn@King.co.za</EmailAddress><RoutingType>SMTP</RoutingType><MailboxType>Mailbox</MailboxType></Mailbox><Mailbox><Name>Michael Collocott</Name><EmailAddress>[email protected]</EmailAddress><RoutingType>SMTP</RoutingType><MailboxType>OneOff</MailboxType></Mailbox><Mailbox><Name>Marguerite De Villiers (king)</Name><EmailAddress>Marguerite.DeVilliers@King.co.za</EmailAddress><RoutingType>SMTP</RoutingType><MailboxType>Mailbox</MailboxType></Mailbox><Mailbox><Name>Zanele Magazi (king)</Name><EmailAddress>Zanele.Magazi@King.co.za</EmailAddress><RoutingType>SMTP</RoutingType><MailboxType>Mailbox</MailboxType></Mailbox></ToRecipients><IsReadReceiptRequested>false</IsReadReceiptRequested><From><Mailbox><Name>Almene Barends</Name><EmailAddress>[email protected]</EmailAddress><RoutingType>SMTP</RoutingType><MailboxType>OneOff</MailboxType></Mailbox></From><IsRead>true</IsRead></Message></Items></GetItemResponseMessage></ResponseMessages></GetItemResponse> 000007372

That's my file up there, my Regex to clean it:

import re
import string
from bs4 import BeautifulSoup

soup = BeautifulSoup(Email, 'lxml')
text = soup.text.strip()
p = re.compile(r'<!--.*-->',re.DOTALL)
text = p.sub('', text)
p = re.compile(r'^\s*$', re.MULTILINE)
text = p.sub('', text)

print(text)
I have two issues, 1: I still get this after cleaning
Quote:NoErrorRE: [EXTERNAL] PL_192_01_28Claire Gravell SANTAMService EscalationNormal

Secondly I get this at the end of my cleaning
Quote:image003.jpgimage/[email protected]:37:13truefalseimage004.jpgimage/[email protected]:37:13truefalseimage005.jpgimage/[email protected]:37:13truefalse396972019-01-28T10:45:35Z2019-01-28T10:45:47ZfalsefalseSmnSmn@King.co.zaSMTPMailboxMichael [email protected] De Villiers (king)Marguerite.DeVilliers@King.co.zaSMTPMailboxZanele Magazi (king)Zanele.Magazi@King.co.zaSMTPMailboxfalseAlmene [email protected] 000007372


(May-13-2019, 11:51 AM)snippsat Wrote:
(May-13-2019, 11:14 AM)stahorse Wrote: I get this text in my output that I want to remove
Show more of text,input and wanted output.
Give it a try,dos matter at all if don't work just to show some effort,so it's just not i want a solution's post.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to remove footer from PDF when extracting to text jh67 3 5,051 Dec-13-2022, 06:52 AM
Last Post: DPaul
  How to remove patterns of characters from text aaander 4 1,109 Nov-19-2022, 03:34 PM
Last Post: snippsat
  Want to remove the text from a particular column in excel shantanu97 2 2,139 Jul-05-2021, 05:42 PM
Last Post: eddywinch82
  More elegant way to remove time from text lines. Pedroski55 6 3,926 Apr-25-2021, 03:18 PM
Last Post: perfringo
  Highlight and remove specific string of text itsalmade 5 3,518 Dec-11-2019, 11:58 PM
Last Post: micseydel
  Need to replace (remove) Unicode characters in text ineuw 1 8,576 Jan-02-2018, 08:01 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020