Oracle11g Regex Non-capturing Groups - regex

Multi-currency REGEXP_SUBSTR Oracle11g
First time posting a question here, so I hope I don't muck it up too badly.
I created a query that pulls various customer order details including charged price, product list price and the big one, the price that was sent to customers via reminder emails.
Using REGEXP_SUBSTR I am able to match all of the prices from the emails HTML content in various currencies but I run into an issue with the output for certain Price currency abbreviation combinations lacking commas or periods: i.e. 123 kr, 999 Pesos or 1 050 Kč.
How can I make this scenario above match the output of the other price formats?
I pulled much of my "inspiration" from Gary's answer here: Regex currency validation.
Datasource HTML
Desired values starting at <!-- START Price Exp.. -->:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank you for using us</title>
<style type="text/css">
.ReadMsgBody {
width: 100%;
}
.ExternalClass {
width: 100%;
}
BODY {
font-family: OpenSans, Arial, Helvetica, sans-serif;
font-size:13px;
color:#555555;
}
TD {
font-family: OpenSans, Arial, Helvetica, sans-serif;
font-size:13px;
color:#555555;
vertical-align: top;
}
A {
color: #f48024;
}
IMG {
display:block;
border: none;
}
H1 {
font-size: 18pt;
}
H2 {
font-size: 15pt;
}
H1, H2, H3, P, UL, LI {
margin: 0;
padding: 0;
}
</style>
</head>
<body style="margin: 0; padding: 0; background-color: #eeeeee" bgcolor="#eeeeee">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin: 0; padding: 0; ">
<tbody>
<tr>
<td align="center" width="100%" >
<!-- TOP-->
<table bgcolor="#eeeeee" border="0" cellpadding="0" cellspacing="0" style="background-color: #eeeeee; width:100%; max-width:900px; ">
<tbody>
<tr>
<td height="34" style="font-size: 1px;"><!-- cell --></td>
</tr>
</tbody>
</table>
<!-- END TOP-->
<!-- LOGO -->
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="width:100%; background-color: #fff; max-width:900px;">
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="background-color: #fff; text-align: center; max-width:650px;">
<tr>
<td align="center" height="40" bgcolor="#fff" style="background-color: #fff; vertical-align: middle; text-align: center; ">
<img align="center" style="" src="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon#2.png?v=73d79a89bded" style="display:block" alt="" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- END LOGO-->
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="width:100%; max-width:900px; background-color: #fff;">
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="width:100%; background-color: #fff; max-width:800px; padding-left:10px; padding-right:10px;">
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: center; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:22px; color:#41424e; line-height: 1.4"><b>Example Template</b></p>
</td>
</tr>
<tr>
<td height="34" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#767683; line-height: 1.4">Dear customername,</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#767683; line-height: 1.4">Your productname - 1PC has been successfully renewed.</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#767683; line-height: 1.4">Details of your sub below.</p>
</td>
</tr>
<tr>
<td height="40" style="font-size: 1px;"><!-- cell --></td>
</tr>
</table>
</td>
</tr>
</table>
<!-- sum-->
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#F2F2F6" style="width:100%; background-color: #F2F2F6; max-width:900px;">
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#F2F2F6" style="width:100%; background-color: #F2F2F6; max-width:800px; padding-left:10px; padding-right:10px;">
<tr>
<td height="34" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: center; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:20px; color:#41424e; line-height: 1.4"><b>Your Auto-Renewal Sub</b></p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#42ba8f; line-height: 1.4"><b>Product</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">Productname - 1 PC</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#42ba8f; line-height: 1.4"><b>Order ID</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">12131415161</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#42ba8f; line-height: 1.4"><b>Exp Prices charged</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<!--START Price Exp, templates could be in numerous different languages but info like i.e. customername, productname, Order ID, Tracking IDs will always use the same format. -->
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">$69.99 (a tax message)</p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">123 kr (b tax message)</p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">999 Pesos (c tax message)</p>
</td>
</tr>
<!--END Price Exps -->
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#42ba8f; line-height: 1.4"><b>Automatically renewed</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">May 20, 2018</p>
</td>
</tr>
<tr>
<td height="42" style="font-size: 1px;"><!-- cell --></td>
</tr>
</table>
</td>
</tr>
</table>
<!--END sum -->
<!-- white-->
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="width:100%; max-width:900px; background-color: #fff;">
<tr>
<td height="15" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" style="width:100%; background-color: #fff; max-width:800px; padding-left:10px; padding-right:10px;">
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">If you’d like to check your order status, please sign in to company.com/orders with the login credentials below.</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4"><b>Order ID:</b> 12131415161</p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4"><b>Password:</b> stAcKoverFlOwrocks</p>
</td>
</tr>
<tr>
<td height="20" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#42ba8f; line-height: 1.4"><b>Your Plan</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4"><strong>Auto-Renewal Terms</strong><p>By completing your purchase, you have authorized us to do a bunch of legal stuff.</p>
</td>
</tr>
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4"><b>Need help?</b></p>
</td>
</tr>
<tr>
<td height="1" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td style="vertical-align: middle;">
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">company.com/help</p>
</td>
</tr>
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:16px; color:#41424e; line-height: 1.4">Thanks for trusting us.</p>
</td>
</tr>
<tr>
<td height="34" style="font-size: 1px;"><!-- cell --></td>
</tr>
</table>
</td>
</tr>
</table>
<!-- END white -->
<!--FOOTER-->
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#777684" style="width:100%; background-color: #E7E7EF; max-width:900px;">
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0" bgcolor="#777684" style="width:100%; background-color: #E7E7EF; max-width:900px;">
<tr>
<td>
<table><tr><td>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:14px; color:#767683; line-height: 1.4">Trouble installing? <u>Visit FAQ</u></p>
<p style="text-align: left; margin:0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size:14px; color:#767683; line-height: 1.4">Curious for more? <u>Find more</u></p>
</td></tr></table>
</td>
<td>
<table align="right" >
</tr> </table>
</td>
</tr>
<tr>
<td height="30" style="font-size: 1px;"><!-- cell --></td>
</tr>
</table>
</td>
</tr>
</table>
<!--END FOOTER -->
</td>
</tr>
</tbody>
</table>
</body>
</html>
REGEX
(NT\$|SAR)\s(\d{2,5})|\d{1,4}([.,]\d{3})*([\s.,]\d{2,3}|[^\W]\d+(\d{1,4})*\s(kr|zł|Pesos|Kč|Ft|บาท|SAR|₪))
Matches all
1.4">$19.99 (some random text)
1.4">R$20.00
1.4">20.00€
1.4">€25,99
1.4">£15.99
1.4">123 kr
1.4">1234 Ft
1.4">999 Pesos
Output
19.99
20.00
20.00
25.99
15.99
123 kr
1234 Ft
999 Pesos
The last three examples should not have a space and/or any letters following the numbers.
How can I remove them from the output but retain the numbers?
I realize this is likely due to the multiple capture groups I have, so I see three potential solutions:
Refine the Regex to eliminate the overuse of groups (I am not skilled enough to figure this out)...
Somehow write Regex non-capturing groups that result in the desired output. I have sadly learned that (?:) simply doesn't work.
Utilize the SQL function parameters to select subexpressions from REGEXP_SUBSTR. However, this doesn't appear to allow more than one subexpression in the output.
SQL
SELECT
REPLACE(REPLACE(REGEXP_SUBSTR(nnc.MESSAGE, '(NT\$|SAR)\s(\d{2,5})|\d{1,4}([.,]\d{3})*([\s.,]\d{2,3}|[^\W]\d+(\d{1,4})*\s(kr|zł|Pesos|Kč|Ft|บาท|SAR|₪))'),',','.'),' ','') AS EMAIL_PRICE_SENT
FROM tablename
WHERE clause;
That is the full statement with a couple nested REPLACE functions to format the output to the system format.
See Regex in action here: Regex 101 Link.
I know this is the wrong language so it will not provide a 100% accurate test but I find it very helpful before running it against the DB. I am always open for better tool suggestions!
I have spent too much time than I am proud of on this, so any assistance would be much appreciated.
Thanks,
Nick

Related

Get data between two tags

I need to extract text between two tags <mail> and </mail>
This is the text
<?xml version='1.0' encoding='utf-16'?>
<li xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<g id='{E5EABB1F-40BC-45BB-8D87-3B6C239B521B}' displayName='Actions' onclick='javascript:return scForm.postEvent(this,event,'forms:addaction')'>
<li id='{D4502A11-9417-4479-9F2A-485F45D2E2D0}' unicid='B048F2B1C5964A1CB64AEEE249C00371'>
<parameters><host>smtp.sendgrid.net</host><port>587</port><login>azure_30e40e370449ef372827bb491abd711d#azure.com</login><password>n8vhr^^mcQE4</password><from>no-reply#test.com</from><isbodyhtml>true</isbodyhtml><to>[{CC59436D-F6A6-4B84-A490-7A6F6ACDF8C9}]</to><cc></cc><bcc></bcc><localfrom>no-reply#test.com</localfrom><subject>[{5A297C9C-4979-49C5-BDE6-F6F5351DF7AA}], thank you for registering for site Community Updates</subject><mail>
<table width='100%' border='0' cellspacing='0' cellpadding='0' class='em_full_wrap' style='background-color: #efefef;'>
<tbody>
<tr>
<td align='center' valign='top'>
<table align='center' width='700' border='0' cellspacing='0' cellpadding='0' class='em_main_table' style='width: 700px; table-layout: fixed; background-color: #efefef;'>
<tbody>
<tr>
<td align='center' valign='middle' class='em_space' style='font-family:Arial, sans-serif; font-size:12px; line-height:15px; color:#000000; padding:23px 10px;'><span class='em_defaultlink'><a href='%%view_email_url%%' target='_blank' style='text-decoration:none; color:#000000;'>View this email online.</a></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align='center' valign='top'>
<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center'>
<tbody>
<tr>
<td align='center' valign='top'>
<table cellpadding='0' cellspacing='0' width='100%' role='presentation' style='min-width: 100%;' class='stylingblock-content-wrapper'>
<tbody>
<tr>
<td class='stylingblock-content-wrapper camarker-inner'><!--BLOCK 01- LOGO-->
<table align='center' border='0' cellpadding='0' cellspacing='0' width='100%'>
<tbody>
<tr>
<td align='center' valign='top'>
<table align='center' border='0' cellpadding='0' cellspacing='0' class='em_main_table' style='width: 700px; background-color: #3e2246;' width='700'>
<tbody>
<tr>
<td align='center' class='em_full_img' style='padding-top: 0px;' valign='top'>
<a conversion='false' data-linkto='https://' href='https://site.test.com/' style='text-decoration:none;' target='_blank'><img alt='site by test' data-assetid='165573' height='182' src='https://image.e.residential.test.com/lib/fe3815707564067c721d73/m/13/new-logo_image.jpg' style='display: block; font-family: Arial, sans-serif; font-size: 24px; line-height: 30px; color: #FFFFFF; max-width: 700px; padding: 0px; text-align: center; height: 182px; width: 700px;' width='700'></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!--//BLOCK 01- LOGO--></td>
</tr>
</tbody>
</table>
<table cellpadding='0' cellspacing='0' width='100%' role='presentation' style='min-width: 100%;' class='stylingblock-content-wrapper'>
<tbody>
<tr>
<td class='stylingblock-content-wrapper camarker-inner'><!--BLOCK 03 - HERO-->
<table align='center' border='0' cellpadding='0' cellspacing='0' width='100%'>
<tbody>
<tr>
<td align='center' valign='top'>
<table align='center' border='0' cellpadding='0' cellspacing='0' class='em_main_table' style='width: 700px; table-layout: fixed; background-color: #ffffff;' width='700'>
<tbody>
<tr>
<td align='center' class='em_full_img' valign='top'>
<img alt='' class='em_g_img' height='400' src='https://image.e.residential.test.com/lib/fe3815707564067c721d73/m/12/g_banner_image.jpg' style='display: block; font-family: Arial, sans-serif; font-size: 18px; line-height: 30px; color: #424242; max-width: 700px; border-width: 0px; border-style: solid;' width='700'></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!--//BLOCK 03 - HERO--></td>
</tr>
</tbody>
</table>
<table cellpadding='0' cellspacing='0' width='100%' role='presentation' style='min-width: 100%;' class='stylingblock-content-wrapper'>
<tbody>
<tr>
<td class='stylingblock-content-wrapper camarker-inner'><!--BLOCK 04 - SUBHEAD-->
<table align='center' border='0' cellpadding='0' cellspacing='0' width='100%'>
<tbody>
<tr>
<td align='center' valign='top'>
<table align='center' border='0' cellpadding='0' cellspacing='0' class='em_main_table' style='width: 700px; table-layout: fixed; background-color: #3e2246;' width='700'>
<tbody>
<tr>
<td align='center' class='em_aside15 em_ptop' style='padding:30px 40px 0px 50px;' valign='top'>
<table align='center' border='0' cellpadding='0' cellspacing='0' width='100%'>
<tbody>
<tr>
<td class='em_font40' style='font-family: Georgia, 'Times New Roman', serif; font-size: 31px; line-height: 40px; color: #ff7f00; text-align: center;' valign='top'>
Thank you for registering for site Community Updates
<table align='center' border='0' cellpadding='0' cellspacing='0' width='100%'>
<tbody>
<tr>
<td style='font-family: Arial, sans-serif; font-size: 15px; line-height: 20px; color: #ffffff; text-align: center;' valign='top'>
<br>
<strong>Welcome to site. You have now been added to the site community database.</strong></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!--//BLOCK 04 - SUBHEAD--></td>
</tr>
</tbody>
</table>
<table cellpadding='0' cellspacing='0' width='100%' role='presentation' style='min-width: 100%;' class='stylingblock-content-wrapper'>
<tbody>
<tr>
<td class='stylingblock-content-wrapper camarker-inner'><!--BLOCK 27 - COMMUNITY-->
<table align='center' border='0' cellpadding='0' cellspacing='0' width='100%'>
<tbody>
<tr>
<td align='center' valign='top'>
<table align='center' border='0' cellpadding='0' cellspacing='0' class='em_main_table' style='width:700px; table-layout:fixed;' width='700'>
<tbody>
<tr>
<td align='center' style='background-color:#3e2246;' valign='top'>
<table align='center' border='0' cellpadding='0' cellspacing='0' class='em_wrapper' style='width:700px;' width='700'>
<tbody>
<tr>
<td class='em_h20' style='height:50px; font-size:1px;line-height:1px;'>
<img alt='' height='1' src='http://image.e.residential.test.com/lib/fe3815707564067c721d73/m/1/a06c1dac-d3ac-4c97-a8fe-f5145ca2811c.gif' style='display: block; border-width: 0px; border-style: solid;' width='1'></td>
</tr>
<tr>
<td align='center' class='em_aside15' valign='top'>
<table border='0' cellpadding='0' cellspacing='0' class='em_wrapper' dir='rtl' style='width:600px;' width='600'>
<tbody>
<tr>
<td valign='top'>
<table align='right' border='0' cellpadding='0' cellspacing='0' class='em_wrapper' dir='ltr' style='width:300px;' width='300'>
<tbody>
<tr>
<td align='center' class='em_full_img' valign='top'>
<img alt='site by test' class='em_g_img' height='176' src='https://image.e.residential.test.com/lib/fe3815707564067c721d73/m/12/image_300x176.jpg' style='display: block; max-width: 300px; font-family: Arial, sans-serif; font-size: 20px; font-weight: bold; color: #ffffff; border-width: 0px; border-style: solid;' width='300'></td>
</tr>
</tbody>
</table>
<!--[if gte mso 9]></td><td valign='top'><![endif]-->
<table align='left' border='0' cellpadding='0' cellspacing='0' class='em_wrapper' dir='ltr' style='width:299px;' width='299'>
<tbody>
<tr>
<td valign='top'>
<table align='center' border='0' cellpadding='0' cellspacing='0' class='em_wrapper' style='width:299px;' width='299'>
<tbody>
<tr>
<td align='center' valign='top'>
<table align='left' border='0' cellpadding='0' cellspacing='0' class='em_wrapper' style='width:299px;' width='299'>
<tbody>
<tr>
<td align='center' class='em_ptop' valign='top'>
<table align='left' border='0' cellpadding='0' cellspacing='0' class='em_wrapper' style='width:270px;' width='270'>
<tbody>
<tr>
<td align='left' class='em_center' style='color:#ff7f00; font-size:26px; line-height:32px; font-family: Georgia,'Times New Roman', serif;' valign='top'>
<span class='em_defaultlink'>KEEP UP TO DATE</span></td>
</tr>
<tr>
<td class='em_h20' style='line-height: 1px;font-size:1px; height:18px;'>
<img alt='' height='1' src='http://image.e.residential.test.com/lib/fe3815707564067c721d73/m/1/a06c1dac-d3ac-4c97-a8fe-f5145ca2811c.gif' style='display: block; border-width: 0px; border-style: solid;' width='1'></td>
</tr>
<tr>
<td align='left' class='em_center' style='font-size: 14px; line-height: 18px; font-family: Arial, sans-serif; color:#ffffff;' valign='top'>
<span class='em_defaultlink'>Find out more about site’s fantastic community events and news ongoing stories. </span></td>
</tr>
<tr>
<td class='em_h20' style='line-height: 1px; font-size:1px; height:32px;'>
<img alt='' height='1' src='http://image.e.residential.test.com/lib/fe3815707564067c721d73/m/1/a06c1dac-d3ac-4c97-a8fe-f5145ca2811c.gif' style='display: block; border-width: 0px; border-style: solid;' width='1'></td>
</tr>
<tr>
<td align='left' valign='top'>
<table align='left' border='0' cellpadding='0' cellspacing='0' class='em_wrapper'>
<tbody>
<tr>
<td align='center' valign='top'>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td class='em_hide' style='width:29px;'>
<img alt='' height='1' src='http://image.e.residential.test.com/lib/fe3815707564067c721d73/m/1/a06c1dac-d3ac-4c97-a8fe-f5145ca2811c.gif' style='display: block; border-width: 0px; border-style: solid;' width='1'></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class='em_h20' style='height:50px; font-size:1px;line-height:1px;'>
<img alt='' height='1' src='http://image.e.residential.test.com/lib/fe3815707564067c721d73/m/1/a06c1dac-d3ac-4c97-a8fe-f5145ca2811c.gif' style='display: block; border-width: 0px; border-style: solid;' width='1'></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!--//BLOCK 27 - COMMUNITY--></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<custom name='opencounter' type='tracking'>
</custom>
</mail><localized></localized></parameters>
</li>
<li id='{31602921-2C7A-42F0-ABFE-58740B47DBF1}' unicid='FD74B915782841298684DA49A56FD568'>
<parameters />
</li>
</g>
</li>
I wrote the following function
Function Get-StringBetweenStartEnd {
Param($Text,$Start,$End)
$Regex = [Regex]::new("(?<="+$Start+")(.*)(?="+$End+")")
$Match = $Regex.Match($String)
if($Match.Success) { Return $Match.Value}else{Return ""}
}
$Result = Get-StringBetweenStartEnd -Text $strInput -Start "<mail>" -End "</mail>"
write-host $Result.Trim()
The value is always null.
Any suggestion would be appreciated. Thanks in advance
By default, the . pattern does not match across multiple lines.
Enable single-line mode to change its behaviour:
Changes the meaning of the dot (.) so it matches every character
(instead of every character except \n).
There are two ways to do it:
By specifying inline option s:
[Regex]::Match( $text, '(?s)<mail>(.*)</mail>' ).Groups.Value
By passing RegexOptions.Singleline to the Regex.Match method:
[Regex]::Match( $text, '<mail>(.*)</mail>',
[Text.RegularExpressions.RegexOptions]::Singleline ).Groups.Value
I took the liberty to simplify your RegEx by changing the lookbehind/lookahead assertions into simple patterns. Using a group to extract the value is simpler in this case.
Note that the static [Regex]::Match() method can be faster as it keeps a cache of compiled regular expressions and thus doesn't have to interpret the RegEx again when the same RegEx is used multiple times (e. g. in a loop).

customising django allauth templates

mostly trying to modify the email verification that is sent on sign-up following the allauth documentation the sent email is modified when i change email_confirmation_message.txt but when i want to use an html representaion the documentation says to use email_confirmation_message.html but it is not recognized and instead it sends the default email or if i include both it only sneds the text one and ignores the html
email_confirmation_message.html :
{% extends "account/email/base_message.txt" %}
{% load account %}
{% load i18n %}
{% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>Snippet - GoSNippets</title>
<link href='https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css' rel='stylesheet'>
<link href='' rel='stylesheet'>
<script type='text/javascript' src=''></script>
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js'></script>
<script type='text/javascript' src='https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/js/bootstrap.min.js'></script>
</head>
<body oncontextmenu='return false' class='snippet-body'>
<div style="display: none; font-size: 1px; color: #fefefe; line-height: 1px; font-family: 'Lato', Helvetica, Arial, sans-serif; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden;"> We're thrilled to have you here! Get ready to dive into your new account. </div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 20px 30px 40px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p style="margin: 0;">We're excited to have you get started on {{ site_domain }}. First, you need to confirm your account. Just press the button below.</p>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="border-radius: 3px;" bgcolor="#FFA73B">Confirm Account</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr> <!-- COPY -->
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 0px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p style="margin: 0;">If that doesn't work, copy and paste the following link in your browser:</p>
</td>
</tr> <!-- COPY -->
</table>
<script type='text/javascript'></script>
</body>
</html>
{% endblocktrans %}{% endautoescape %}{% endblock %}
ok,so i figured it out. you have to also change email_confirmation_signup_message.txt
to email_confirmation_signup_message.html and inside it change {% include "account/email/email_confirmation_message.txt" %} to {% include "account/email/email_confirmation_message.html" %}

Is there any pre-requisits as a sender to use promotab?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="application/ld+json">
[{
"#context": "http://schema.org/",
"#type": "Organization",
"logo": "https://www.gstatic.com/images/branding/product/1x/googleg_48dp.png"
},{
"#context": "http://schema.org/",
"#type": "EmailMessage",
"subjectLine": "[Important] Please add subject line in annotation"
},{
"#context": "http://schema.org/",
"#type": "DiscountOffer",
"description": "20% off",
"discountCode": "PROMO",
"availabilityStarts": "2021-04-07T09:19:24-07:00",
"availabilityEnds": "2021-04-10T09:19:24-07:00"
},{
"#context": "http://schema.org/",
"#type": "PromotionCard",
"image": "https://www.google.com/gmail-for-marketers/promo-tab/markup-tool/sample.png"
}]
</script>
</head>
<body style="margin: 0px; padding: 0px; min-width: 100%; background-color: rgb(243, 242, 240); cursor: auto;">
<center class="wrapper" style="width:100%;table-layout:fixed;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;background-color:#f3f2f0;">
<table bgcolor="#f3f2f0;" border="0" cellpadding="0" cellspacing="0" style="background-color:#f3f2f0;" width="100%">
<tbody>
<tr>
<td width="100%">
<div class="webkit" style="max-width:600px;Margin:0 auto;"><!--[if (gte mso 9)|(IE)]>
<table width="600" align="center" cellpadding="0" cellspacing="0" border="0" style="border-spacing:0" >
<tr>
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]--><!-- ======= start main body ======= -->
<table align="center" border="0" cellpadding="0" cellspacing="0" class="outer" style="border-spacing:0;Margin:0 auto;width:100%;max-width:600px;">
<tbody>
<tr>
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;"><!-- ======= start header ======= -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
<tbody>
<tr>
<td align="center">
<center>
<table align="center" border="0" cellpadding="0" cellspacing="0" style="Margin: 0 auto;" width="100%">
<tbody>
<tr>
<td bgcolor="#FFFFFF" class="one-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;"><!-- ======= start header ======= -->
<table bgcolor="#f3f2f0" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="two-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:left;font-size:0;"><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="20%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:30px;" >
<![endif]-->
<div class="column" style="width:100%;max-width:80px;display:inline-block;vertical-align:top;">
<table class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="left" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:5px;"><img align="left" alt="" height="60" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/dbe9c57f-5e00-4d9f-9719-5d36a9a02ebc.jpg" style="border-width:0; max-width:60px;height:auto; display:block" width="60" /></td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="80%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:518px;display:inline-block;vertical-align:top;">
<table border="0" cellpadding="0" cellspacing="0" style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:0px;padding-bottom:10px; padding-right:10px;padding-left:10px;">
<table border="0" cellpadding="0" cellspacing="0" class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="left" valign="top"></td>
</tr>
<tr>
<td align="right" valign="top"><img alt="" height="16" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/c01afe22-e370-4df3-b96e-927714713f51.jpg" style="border-width:0; max-width:20px;height:auto; max-height:16px; padding-top:0px; padding-left:10px" width="20" /><font style="font-size:11px; text-decoration:none; color:#474b53; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:16px; padding-bottom:30px">View as a web page</font></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- ======= end header ======= --><!-- ======= start two column ======= -->
<table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" style=" border-left:1px solid #e8e7e5; border-right:1px solid #e8e7e5" width="100%">
<tbody>
<tr>
<td align="center" background="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/595fac04-56a2-46f4-982e-69600273e5d0.jpg" bgcolor="#1f3ca6" class="two-column" height="260" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:center;font-size:0" valign="top" width="600"><!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:600px;height:260px;">
<v:fill type="tile" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/595fac04-56a2-46f4-982e-69600273e5d0.jpg" color="#1f3ca6" />
<v:textbox inset="0,0,0,0">
<![endif]-->
<div><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:299px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:20px;padding-bottom:10px; padding-right:10px;padding-left:30px;">
<table class="contents1" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="center" style="padding-top:20px; padding-right:30px" valign="middle">
<p style="font-size:30px; text-decoration:none; color:#ffffff; font-family: Verdana, Geneva, sans-serif; text-align:left"><strong>Lorem Ipsum</strong></p>
<p style="font-size:14px; text-decoration:none; color:#ffffff; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:18px">Consectetur hi $name$ elitsed do eiusmod tempor sitabore et dolore magna aliqua.<br />
<br />
<strong>Read more »</strong></p>
<table align="center" border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center" bgcolor="#ffffff" height="40" style="-moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px;" width="120"><a class="button_link" href="#" style="width:120; display:block; text-decoration:none; border:0; text-align:center; font-weight:bold;font-size:13px; font-family: Arial, sans-serif; color: #1f3ca6">Read more » </a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:299px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td align="right" style="padding-top:20px;padding-bottom:0;padding-right:0;padding-left:0;"><img alt="" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/fc68f7b7-efa6-45db-8b6f-ac6f78ae6782.png" style="border-width:0;width:100%; height:auto;" width="290" /></td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></div>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]--></td>
</tr>
</tbody>
</table>
<!-- ======= end two column ======= --><!-- ======= start two column ======= -->
<table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="two-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:center;font-size:0;"><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:300px;display:inline-block;vertical-align:top;">
<table bgcolor="#FFFFFF" class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="left"><img alt="" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/c11788a0-0366-43bd-812f-4756c82a6f93.jpg" style="border-width:0;width:100%; height:auto;display:block" width="300" /></td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:300px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:0px;padding-bottom:10px; padding-right:20px;padding-left:30px;">
<table class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="center" style="padding-top:20px; padding-right:30px" valign="middle">
<p style="font-size:20px; text-decoration:none; color:#262626; font-family: Verdana, Geneva, sans-serif; text-align:left"><strong>lorem ipsum</strong></p>
<p style="font-size:14px; text-decoration:none; color:#3a3d41; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:18px">Lorem ipsum dolor lorem cupidat non proident, sunt in culpa qui officia deserunt mollit telaborum.<br />
</p>
<table align="left" border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center" bgcolor="#1f3ca6" height="40" style="-moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px;" width="120"><a class="button_link" href="#" style="width:120; display:block; text-decoration:none; border:0; text-align:center; font-weight:bold;font-size:13px; font-family: Arial, sans-serif; color: #ffffff">Read more » </a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p style="font-size:14px; text-decoration:none; color:#3a3d41; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:18px"></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></td>
</tr>
</tbody>
</table>
<!-- ======= end two column ======= --><!-- ======= start two column ======= -->
<table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="two-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:center;font-size:0;"><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:299px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:0px;padding-bottom:10px; padding-right:20px;padding-left:30px;">
<table class="contents1" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="center" style="padding-top:20px; padding-right:30px" valign="middle">
<p style="font-size:20px; text-decoration:none; color:#262626; font-family: Verdana, Geneva, sans-serif; text-align:left"><strong>lorem ipsum</strong></p>
<p style="font-size:14px; text-decoration:none; color:#3a3d41; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:18px">Lorem ipsum dolor lorem cupidat non proident, sunt in culpa qui officia deserunt mollit telaborum.<br />
</p>
<table align="left" border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" style="Margin:0 auto;">
<tbody>
<tr>
<td align="center" bgcolor="#1f3ca6" height="40" style="-moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px;" width="120"><a class="button_link" href="#" style="width:120; display:block; text-decoration:none; border:0; text-align:center; font-weight:bold;font-size:13px; font-family: Arial, sans-serif; color: #ffffff">Read more » </a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p style="font-size:14px; text-decoration:none; color:#3a3d41; font-family: Verdana, Geneva, sans-serif; text-align:left; line-height:18px"></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:300px;display:inline-block;vertical-align:top;">
<table bgcolor="#FFFFFF" class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="left" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;"><img alt="" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/4dccd1e6-3ce2-4fd9-9b94-635e70bb09e2.jpg" style="border-width:0;width:100%; height:auto; display:block" width="300" /></td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></td>
</tr>
</tbody>
</table>
<!-- ======= end two column ======= --><!-- ======= start two column ======= -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td align="center" background="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/595fac04-56a2-46f4-982e-69600273e5d0.jpg" bgcolor="#1f3ca6" class="two-column" height="200" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:center;font-size:0" valign="top" width="600"><!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:600px;height:200px;">
<v:fill type="tile" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/595fac04-56a2-46f4-982e-69600273e5d0.jpg" color="#1f3ca6" />
<v:textbox inset="0,0,0,0">
<![endif]-->
<div><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:299px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:20px;padding-bottom:10px; padding-right:10px;padding-left:30px;">
<table class="contents1" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="center" style="padding-top:20px; padding-right:30px" valign="middle">
<p style="color:#ffffff; font-size:25px; text-align:center; font-family: Verdana, Geneva, sans-serif; line-height:22px ; text-transform:uppercase">lorem ipsum</p>
<p style="color:#ffffff; font-size:60px; text-align:center; font-family: Verdana, Geneva, sans-serif">40%</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="50%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:299px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td align="right" style="padding-top:20px;padding-bottom:0;padding-right:0;padding-left:0;"><img alt="" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/934e8df4-ef47-4dc5-b8e3-a1ccab54963d.png" style="border-width:0;width:100%; height:auto;" width="282" /></td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></div>
<!--[if gte mso 9]>
</v:textbox>
</v:rect>
<![endif]--></td>
</tr>
</tbody>
</table>
<!-- ======= end two column ======= --><!-- ======= start footer ======= -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td height="30"></td>
</tr>
<tr>
<td class="two-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;text-align:center;font-size:0;"><!--[if (gte mso 9)|(IE)]>
<table width="100%" style="border-spacing:0" >
<tr>
<td width="60%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" >
<![endif]-->
<div class="column" style="width:100%;max-width:350px;display:inline-block;vertical-align:top;">
<table class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="right" style="padding-top:0;padding-bottom:0;padding-right:10px;padding-left:0;" width="39%"><img alt="" height="59" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/13f425ab-c680-4ae0-88de-7b493d95095f.jpg" style="border-width:0; max-width:59px;height:auto; display:block; padding-right:20px" width="59" /></td>
<td align="left" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" valign="middle" width="61%">
<p style="color:#787777; font-size:13px; text-align:left; font-family: Verdana, Geneva, sans-serif">Lorem ipsum © 2017<br />
lorem ipsum lorem ipsum<br />
lorem ipsum lorem ipsum</p>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]>
</td><td width="40%" valign="top" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" > <![endif]-->
<div class="column" style="width:100%;max-width:248px;display:inline-block;vertical-align:top;">
<table style="border-spacing:0" width="100%">
<tbody>
<tr>
<td class="inner" style="padding-top:0px;padding-bottom:10px; padding-right:10px;padding-left:10px;">
<table class="contents" style="border-spacing:0; width:100%">
<tbody>
<tr>
<td align="center" style="padding-top:10px" valign="top" width="32%">
<table border="0" cellpadding="0" cellspacing="0" width="150">
<tbody>
<tr>
<td align="center" width="33"><img alt="facebook" border="0" height="36" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/1f9161ee-46b5-4bdf-86db-9e32d4b98336.jpg" style="border-width:0; max-width:36px;height:auto; display:block; max-height:36px" width="36" /></td>
<td align="center" width="34"><img alt="twitter" border="0" height="36" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/4e449140-ec71-4978-97bf-8e0f15b5ff23.jpg" style="border-width:0; max-width:36px;height:auto; display:block; max-height:36px" width="36" /></td>
<td align="center" width="33"><img alt="linkedin" border="0" height="36" src="https://gallery.mailchimp.com/fdcaf86ecc5056741eb5cbc18/images/d21cca91-335e-4fa4-9313-b0ea37e0452b.jpg" style="border-width:0; max-width:36px;height:auto; display:block; max-height:36px" width="36" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if (gte mso 9)|(IE)]> </td> </tr> </table> <![endif]--></td>
</tr>
<tr>
<td height="30" style="text-align: center;"><span style="font-size:20px;"><span style="color: rgb(39, 65, 107); font-family: engagefont, "Helvetica Neue", "Calibri Light", Roboto, sans-serif, "Microsoft YaHei", 微软雅黑, STXihei, 华文细黑, "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, メイリオ, Meiryo, "MS Pゴシック", "MS PGothic", "Malgun Gothic"; background-color: rgb(255, 255, 255);">$unsub$</span></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="0" class="outer" style="border-spacing:0;Margin:0 auto;width:100%;max-width:600px;">
<tbody>
<tr>
<td style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;"><span style="font-size:20px;"><!-- ======= end footer ======= --></span></td>
</tr>
</tbody>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]--></div>
</td>
</tr>
</tbody>
</table>
</center>
</body>
</html>
I am working for an emailing platform and I've been asked by a customer if we enabled Google Promotab in email designs.
I have read the documentation, tried to do a test yet I couldn't manage to display the promotion. My Gmail account is not ending with "promotabtesting#gmail" but it is configured as expected on troubleshooting section.
Are there any pre-requisits as a sender to enable the promotab feature?
I ask for both our clients (Brands) and my company that doesn't figure on "they support promotab" here : https://developers.google.com/gmail/promotab/overview but could be very soon.
Thanks a lot for your help
Max
Project Manager

Is there an expression that will return all siblings for a parent node in xslt

For each 'paymentSummaries' section, a new table will be created and
I've been able to get this to work. What isn't working is getting the
paymentSummary/splitCode/(number)(type)(policyDetails)(amountPaid) to
display (return) more than just the first instance in each table.
Here is my XML:
<paymentSummaries>
<billingAccountNumber>billingAccountNumber1</billingAccountNumber>
<paymentSummary>
<splitCode>
<number>paymentSummary1</number>
<type>type1</type>
<policyDetails>policyDetails1</policyDetails>
<amountPaid>amountPaid1</amountPaid>
</splitCode>
</paymentSummary>
<paymentSummary>
<splitCode>
<number>paymentSummary2</number>
<type>type2</type>
<policyDetails>policyDetails2</policyDetails>
<amountPaid>amountPaid2</amountPaid>
</splitCode>
</paymentSummary>
<serviceFee>serviceFee1</serviceFee>
<totalAmountPaid>totalAmountPaid1</totalAmountPaid>
</paymentSummaries>
This is what I've tried so far. The first example returns just the
first instance. The second example returns nothing/blank.
1st Example:
I have a <xsl:for-each
select="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']">
wrapping around the entire table (this gets it to repeat the table for
each that's passed.
For the individual child and sibling elements, I haven't specified any
<for-each> or <if> tests because I thought it would just repeat the
instances.
2nd Example:
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<xsl:if test="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='number'] != ''">
<td align="left" valign="top" style="padding: 8px 5px 0px 10px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="170" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='number']"></xsl:value-of>
</div>
</td>
<td width="270" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='type']"></xsl:value-of>
</div>
</td>
</tr>
</table>
</td>
<td width="95" align="right" valign="top" class="width150" style="padding: 8px 5px 0px 10px;">
<div class="FS13 LH18" style="font-size:14px; line-height:20px; color:#313131; font-weight:normal;font-family: Arial Narrow, Arial, Helvetica, sans-serif;">
<xsl:value-of select="*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='amountPaid']"</xsl:value-of>
</div>
</td>
</xsl:if>
</tr>
<xsl:for-each select="*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][position() >1]">
<tr>
<td align="left" valign="top" style="padding: 8px 5px 0px 10px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="170" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="*[local-name()='number']"></xsl:value-of>
</div>
</td>
<td width="270" height="25" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="*[local-name()='type']"></xsl:value-of>
</div>
</td>
</tr>
</table>
</td>
<td width="95" align="right" valign="top" class="width150" style="padding: 8px 5px 0px 10px;">
<div class="FS13 LH18" style="font-size:14px; line-height:20px; color:#313131; font-weight:normal;font-family: Arial Narrow, Arial, Helvetica, sans-serif;">
<xsl:value-of select="*[local-name()='amountPaid']"></xsl:value-of>
</div>
</td>
</tr>
</xsl:for-each>
<tr bgcolor="#ffffff">
<xsl:if test="SFF/*[local-name()='paymentReceipt']/*[local-name()='paymentSummaries']/*[local-name()='paymentSummary']/*[local-name()='splitCode'][1]/*[local-name()='policyDetails'] != ''">
<td align="left" valign="top" style="padding: 0px 5px 8px 10px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="175" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
</div>
</td>
<td width="270" align="left" valign="top" class="fl wrap width150">
<div class="FS13 LH18" style="font-family: Arial Narrow, Arial, Helvetica, sans-serif;font-size:14px; line-height:20px; color:#313131; font-weight:normal;">
<xsl:value-of select="*[local-name()='splitCode'][1]/*[local-name()='policyDetails']" />
</div>
</td>
</tr>
</table>
</td>
</xsl:if>
</tr>
<table>
This is what I'm getting Table 1: paymentSummary1 type1 amountPaid1
policyDetails1 (this table is missing paymentSummary2, type2, etc.)
Table 2: paymentSummary3 type3 amountPaid3 (this table is
missing paymentSummary4, type4, etc.
policyDetails3
Any ideas how I can get this to work properly?
I think I can see what you are trying to do: put all of the payment summaries in a table followed by a single policyDetail
You start out by saying "For each 'paymentSummaries' section, a new table will be created ... "
So you want to start by doing that:
<xsl:template select='/'>
<xsl:for-each select='//paymentSummaries'>
<table>
<xsl:apply-templates select='paymentSummary'/>
<xsl:call-template name='policy'/>
</table>
</xsl:for-each>
</xsl:template>
next you ned to decide what you are going to do for each of the paymentSummary blocks. Here, I am just adding a new row to the table
<xsl:template match='paymentSummary'>
<tr>
<td>
<xsl:value-of select='splitCode/number'/>
</td>
<td>
<xsl:value-of select='splitCode/type'/>
</td>
<td>
<xsl:value-of select='splitCode/amountPaid'/>
</td>
</tr>
</xsl:template>
Finally, I add the policy part: note the call-template instead of apply-template as I only want to do this once.
<xsl:template name='policy'>
<tr>
<td>
<xsl:value-of select='paymentSummary[1]/splitCode/policyDetails'/>
</td>
</tr>
</xsl:template>
Once you have the general layout of what you want, go ahead and put in your own styling

Django reportlab insert pagebreak html-side

I'm trying to insert a pagebreak after a table in a pdf I'm generating with reportlab, I'm using the following function to generate the pdf:
def render_to_pdf(template_src, context_dict):
template = get_template(template_src)
context = Context(context_dict)
html = template.render(context)
result = StringIO.StringIO()
pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), dest=result, link_callback=fetch_resources)
if not pdf.err:
return result.getvalue()
return HttpResponse('We had some errors<pre>%s</pre>' % escape(html))
def fetch_resources(uri, rel):
return os.path.join(MEDIA_ROOT, uri.replace(MEDIA_URL, ""))
I'm calling the function from a view this way:
#login_required(login_url=reverse('accounts:login_box'))
def quote_pdf(request, quote_id):
data_pdf = {}
quote = get_object_or_404(Quote, id=quote_id)
data_pdf['pagesize'] = 'letter'
data_pdf['quote'] = quote
pdf = render_to_pdf('rents/quote_pdf.html', data_pdf)
return HttpResponse(pdf, mimetype='application/pdf')
And this is my template (quote_pdf.html)
{% load humanize compress verbatim %}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Cotización No. {{ quote.id }} Flasherz.co/alquiler</title>
<style type="text/css">
#page {
size: {{ pagesize }};
margin: 1cm;
#frame footer {
-pdf-frame-content: footerContent;
bottom: 0cm;
margin-left: 0cm;
margin-right: 0cm;
height: 0cm;
}
}
</style>
<style type="text/css">
body {
font-size: 12px;
line-height: 13px;
}
div#pdf-header {
display: block;
}
div#pdf-header h2 {
display: block;
text-align: center;
font-weight: normal;
line-height: 35px;
font-size: 18px;
}
div#pdf-quote-info {
display: block;
margin-bottom: 20px;
}
p {
margin: 0;
}
table {
border-top: 1px solid #eee;
}
table td, table th {
border-right: 1px solid #eee;
border-bottom: 1px solid #eee;
padding: 5px;
border-left: 1px solid #eee;
}
table .price {
text-align: right;
}
table th {
padding: 5px 0;
font-size: 13px;
text-transform: uppercase;
color: black;
text-align: left;
background-color: #eee;
padding-left: 5px;
}
table p.description {
color: #555;
font-size: 11px;
}
table#quote-info {
border: none;
}
table#quote-info td, table#quote-info th {
border: none;
padding: 0;
}
table td.quantity {
text-align: center;
}
</style>
</head>
<body>
<div id="pdf-header">
<div style="width: 100%; text-align: center;">
<img src="{{ STATIC_URL }}img/quotes-logo.jpeg" alt="Flasherz.co Alquiler" width="600" height="126" />
<div style="display: block; text-align: center; margin: 10px 0;">
<h2>Cotización No. {{ quote.id }}, {{ quote.client_name }}</h2>
</div>
</div>
</div>
<div id="pdf-quote-info">
<table id="quote-info" width="70%" border="none" cellpadding="3" cellspacing="0">
<tr>
<td width="25%">Fecha:</td>
<td width="75%">{{ quote.created|date:'l j' }} de {{ quote.created|date:'F' }} de {{ quote.created|date:'Y' }}</td>
</tr>
{% if quote.client_name %}
<tr>
<td>Cliente:</td>
<td>{{ quote.client_name }}</td>
</tr>
{% endif %}
{% if quote.client_email %}
<tr>
<td>Correo:</td>
<td>{{ quote.client_email }}</td>
</tr>
{% endif %}
{% if quote.client_address %}
<tr>
<td>Dirección:</td>
<td>{{ quote.client_address }}</td>
</tr>
{% endif %}
{% if quote.client_phone %}
<tr>
<td>Teléfono:</td>
<td>{{ quote.client_phone }}</td>
</tr>
{% endif %}
<tr>
<td>Cantidad de días:</td>
<td>{{ quote.rental_days }}</td>
</tr>
</table>
</div>
</div>
<div id="pdf-quote-table">
<table id="quote-table" cellpadding="0" cellspacing="0" width="100%">
{% for category in quote.categories.all %}
<tbody>
<tr>
<th colspan="4" class="category-header">{{ category.category.name }}</th>
</tr>
{% for item in category.items.all %}
<tr>
<td class="quantity" width="10%">
<p>{{ item.quantity }}</p>
</td>
<td class="name" width="50%">
<p class="name">{{ item.name }}</p>
{% if item.content %}<p class="description">{{ item.content }}</p>{% endif %}
</td>
<td class="price" width="20%">
<p>${{ item.price|intcomma }}</p>
</td>
<td class="price total-price" width="20%">
<p>${{ item.total_price|intcomma }}</p>
</td>
</tr>
{% endfor %}
</tbody>
{% endfor %}
<tbody id="others">
<tr>
<th colspan="4" class="category-header">Seguro del 10%</th>
</tr>
<tr>
<td class="quantity"></td>
<td class="name">Seguro 10%</td>
<td class="price"></td>
<td class="price total-price">
<p>${{ quote.get_insurance_price|intcomma }}</p>
</td>
</tr>
</tbody>
{% if quote.discount %}
<tbody id="others">
<tr>
<th colspan="4" class="category-header">Descuento</th>
</tr>
<tr>
<td class="quantity">
</td>
<td class="name">Descuento</td>
<td class="price"></td>
<td class="price total-price">
<p>${{ quote.discount|intcomma }}</p>
</td>
</tr>
</tbody>
{% endif %}
<tbody id="totals">
<tr>
<th colspan="4" class="category-header">Total</th>
</tr>
<tr>
<td class="fake" colspan="2"></td>
<td class="name">Subtotal</td>
<td class="price">
<p>${{ quote.get_subtotal|intcomma }}</p>
</td>
</tr>
<tr>
<td class="fake" colspan="2"></td>
<td class="name">Total días</td>
<td class="price">
<p>${{ quote.get_total_days|intcomma }}</p>
</td>
</tr>
<tr>
<td class="fake" colspan="2"></td>
<td class="name">Total</td>
<td class="price">
<p><strong>${{ quote.get_total|intcomma }}</strong></p>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
I don't know the way to insert a pagebreak after the table to insert the "terms and conditions" in the next page.
Also I have a problem with the images in the pdf, no one is appearing when rendered.
Thanks for helping me
From what I've learned in Pisa's documentation (and this forum post), you can use standard CSS tags like page-break-after and page-break-before. Pisa also has some of it's own tags, like pdf:nextpage. To use this, simply insert the following code block where you would like the page break (the div's are necessary so Pisa's HTML5 parser doesn't try to interpret them):
<div>
<pdf:nextpage />
</div>
I've found the correct method to do it, I needed to insert a few specific styles in the of my pdf
<style type="text/css">
#page {
size: {{ pagesize }};
margin: 1cm;
#frame footer {
-pdf-frame-content: footerContent;
bottom: 0cm;
margin-left: 0cm;
margin-right: 0cm;
height: 0cm;
}
}
.page-break{
page-break-after: always;
}
</style>
Then put a element with .page-break class in where you want to have a page break in your pdf.
I had no luck with the css method.
Just insert this bit of code in your template.html wherever you want a page break. It works for me. I'm not sure, but I think it has to be in a div.
<div>
<pdf:nextpage />
</div>