Is there any pre-requisits as a sender to use promotab? - gmail-promo-tab
<!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
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).
Building a table with the values of children whose parents only have siblings with particular attribute values
I apologize for all of the code, but I couldn't eliminate any more without muddling the clarity of the question. Suppose I have this XML: <Dataset> <Rec RN="FOO"> <Fld FN="ID">ID_1</Fld> <Fld FN="OPT">0</Fld> <Fld FN="DESCRIPTION">DESCRIPTION_1</Fld> </Rec> <Rec RN="BAR" RC="3"> <Fld FN="ID">ID_2</Fld> <Fld FN="TYPE">TYPE_1</Fld> </Rec> <Rec RN="BAR"> <Fld FN="ID">ID_3</Fld> <Fld FN="TYPE">TYPE_2</Fld> </Rec> <Rec RN="FOO"> <Fld FN="ID">ID_4</Fld> <Fld FN="OPT">1</Fld> <Fld FN="DESCRIPTION">DESCRIPTION_2</Fld> </Rec> <Rec RN="BAR" RC="3"> <Fld FN="ID">ID_5</Fld> <Fld FN="TYPE">TYPE_4</Fld> </Rec> <Rec RN="BAR"> <Fld FN="ID">ID_6</Fld> <Fld FN="TYPE">TYPE_5</Fld> </Rec> <Rec RN="SPAM"> <Fld FN="CLASS">CLASS_1</Fld> </Rec> </Dataset> And the following XSLT: <?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="Dataset"> <html> <head> <link rel="stylesheet" type="text/css" href="On-line Styles.css"/> </head> <body> <p class="subheading"> Commands </p> <p> <xsl:choose> <xsl:when test="Rec[#RN='FOO']"> <xsl:apply-templates select="Rec[#RN='FOO']"/> </xsl:when> <xsl:otherwise> None </xsl:otherwise> </xsl:choose> </p> </body> </html> </xsl:template> <xsl:template match="Rec[#RN='FOO']"> <xsl:for-each select="."> <xsl:value-of select="Fld[#FN='ID']"/> <xsl:if test="Fld[#FN='OPT'] = 1"> (Optional) </xsl:if> - <xsl:value-of select="Fld[#FN='DESCRIPTION']"/> <p> <xsl:choose> <xsl:when test="../Rec[#RN='FOO']"> <table style="border-collapse: separate;" cellspacing="4" border="2" bordercolorlight="#c0c0c0" bordercolordark="#c0c0c0"> <tr bgcolor="#C0C0C0"> <td style="width: 35%; padding: 6px;" valign="top"> <p class="Tableheader" style="margin-bottom: 0;"> <span style="font-weight: bold;">ID</span> </p> </td> <td style="width: 45%; padding: 6px;" valign="top"> <p class="Tableheader" style="margin-bottom: 0;"> <span style="font-weight: bold;">TYPE</span> </p> </td> </tr> <xsl:for-each select="../Rec[#RN='BAR']"> <xsl:if test="preceding-sibling::Rec/#RN='FOO'"> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;"> <xsl:choose> <xsl:when test="Fld[#FN='ID']"> <xsl:value-of select="Fld[#FN='ID']"/> </xsl:when> <xsl:otherwise> <td> </td> </xsl:otherwise> </xsl:choose> </p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;"> <xsl:choose> <xsl:when test="Fld[#FN='TYPE']"> <xsl:value-of select="Fld[#FN='TYPE']"/> </xsl:when> <xsl:otherwise> <td> </td> </xsl:otherwise> </xsl:choose> </p> </td> </tr> </xsl:if> </xsl:for-each> </table> </xsl:when> </xsl:choose> </p> </xsl:for-each> </xsl:template> </xsl:stylesheet> I get the following output for the tables: Table 1 <table style="border-collapse: separate;" cellspacing="4" border="2" bordercolorlight="#c0c0c0" bordercolordark="#c0c0c0"> <tr bgcolor="#C0C0C0"> <td style="width: 35%; padding: 6px;" valign="top"> <p class="Tableheader" style="margin-bottom: 0;"> <span style="font-weight: bold;">ID</span> </p> </td> <td style="width: 45%; padding: 6px;" valign="top"> <p class="Tableheader" style="margin-bottom: 0;"> <span style="font-weight: bold;">TYPE</span> </p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_2</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_1</p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_3</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_2</p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_5</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_4</p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_6</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_5</p> </td> </tr> </table> Table 2 <table style="border-collapse: separate;" cellspacing="4" border="2" bordercolorlight="#c0c0c0" bordercolordark="#c0c0c0"> <tr bgcolor="#C0C0C0"> <td style="width: 35%; padding: 6px;" valign="top"> <p class="Tableheader" style="margin-bottom: 0;"> <span style="font-weight: bold;">ID</span> </p> </td> <td style="width: 45%; padding: 6px;" valign="top"> <p class="Tableheader" style="margin-bottom: 0;"> <span style="font-weight: bold;">TYPE</span> </p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_2</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_1</p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_3</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_2</p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_5</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_4</p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_6</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_5</p> </td> </tr> </table> What I need is for each table to only display the ID and TYPE text values for only the <Rec RN="BAR">s following the <Rec RN="FOO"> and before the next <Rec RN="FOO"> or <Rec> with another #RN value. There can be 1 to n number of <Rec RN="BAR"> following a <Rec RN="FOO">. The following example shows the output I need: Table 1 <table style="border-collapse: separate;" cellspacing="4" border="2" bordercolorlight="#c0c0c0" bordercolordark="#c0c0c0"> <tr bgcolor="#C0C0C0"> <td style="width: 35%; padding: 6px;" valign="top"> <p class="Tableheader" style="margin-bottom: 0;"> <span style="font-weight: bold;">ID</span> </p> </td> <td style="width: 45%; padding: 6px;" valign="top"> <p class="Tableheader" style="margin-bottom: 0;"> <span style="font-weight: bold;">TYPE</span> </p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_2</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_1</p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_3</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_2</p> </td> </tr> </table> Table 2 <table style="border-collapse: separate;" cellspacing="4" border="2" bordercolorlight="#c0c0c0" bordercolordark="#c0c0c0"> <tr bgcolor="#C0C0C0"> <td style="width: 35%; padding: 6px;" valign="top"> <p class="Tableheader" style="margin-bottom: 0;"> <span style="font-weight: bold;">ID</span> </p> </td> <td style="width: 45%; padding: 6px;" valign="top"> <p class="Tableheader" style="margin-bottom: 0;"> <span style="font-weight: bold;">TYPE</span> </p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_5</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_4</p> </td> </tr> <tr> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">ID_6</p> </td> <td style="padding: 6px;" valign="top"> <p style="margin-bottom: 0;">TYPE_5</p> </td> </tr> </table>
If I understand this correctly (which is not at all certain), you want to do something like this: XSLT 1.0 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:key name="rows" match="Rec[#RN='BAR']" use="generate-id(preceding-sibling::Rec[#RN='FOO'][1])" /> <xsl:template match="/Dataset"> <html> <body> <xsl:apply-templates select="Rec[#RN='FOO']"/> </body> </html> </xsl:template> <xsl:template match="Rec[#RN='FOO']"> <table border="1"> <tr> <th>ID</th> <th>TYPE</th> </tr> <xsl:apply-templates select="key('rows', generate-id())"/> </table> <p/> </xsl:template> <xsl:template match="Rec[#RN='BAR']"> <tr> <td> <xsl:value-of select="Fld[#FN='ID']"/> </td> <td> <xsl:value-of select="Fld[#FN='TYPE']"/> </td> </tr> </xsl:template> </xsl:stylesheet> Applied to your example input, the result will be: <html> <body> <table border="1"> <tr> <th>ID</th> <th>TYPE</th> </tr> <tr> <td>ID_2</td> <td>TYPE_1</td> </tr> <tr> <td>ID_3</td> <td>TYPE_2</td> </tr> </table> <p></p> <table border="1"> <tr> <th>ID</th> <th>TYPE</th> </tr> <tr> <td>ID_5</td> <td>TYPE_4</td> </tr> <tr> <td>ID_6</td> <td>TYPE_5</td> </tr> </table> <p></p> </body> </html> rendered as:
Regex - How to properly grab nested value
I understand parsing html with a regex isn't ideal, but I have a use case for it. I have this coverage report/html page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>LCOV - .info.cleaned</title> <link rel="stylesheet" type="text/css" href="gcov.css"> </head> <body> <table width="100%" border=0 cellspacing=0 cellpadding=0> <tr><td class="title">LCOV - code coverage report</td></tr> <tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr> <tr> <td width="100%"> <table cellpadding=1 border=0 width="100%"> <tr> <td width="10%" class="headerItem">Current view:</td> <td width="35%" class="headerValue">top level</td> <td width="5%"></td> <td width="15%"></td> <td width="10%" class="headerCovTableHead">Hit</td> <td width="10%" class="headerCovTableHead">Total</td> <td width="15%" class="headerCovTableHead">Coverage</td> </tr> <tr> <td class="headerItem">Test:</td> <td class="headerValue">.info.cleaned</td> <td></td> <td class="headerItem">Lines:</td> <td class="headerCovTableEntry">399</td> <td class="headerCovTableEntry">1019</td> <td class="headerCovTableEntryLo">39.2 %</td> </tr> <tr> <td class="headerItem">Date:</td> <td class="headerValue">2016-11-07</td> <td></td> <td class="headerItem">Functions:</td> <td class="headerCovTableEntry">22</td> <td class="headerCovTableEntry">67</td> <td class="headerCovTableEntryLo">32.8 %</td> </tr> <tr><td><img src="glass.png" width=3 height=3 alt=""></td></tr> </table> </td> </tr> <tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr> </table> <center> <table width="80%" cellpadding=1 cellspacing=1 border=0> <tr> <td width="50%"><br></td> <td width="10%"></td> <td width="10%"></td> <td width="10%"></td> <td width="10%"></td> <td width="10%"></td> </tr> <tr> <td class="tableHead">Directory <span class="tableHeadSort"><img src="glass.png" width=10 height=14 alt="Sort by name" title="Sort by name" border=0></span></td> <td class="tableHead" colspan=3>Line Coverage <span class="tableHeadSort"><img src="updown.png" width=10 height=14 alt="Sort by line coverage" title="Sort by line coverage" border=0></span></td> <td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><img src="updown.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></span></td> </tr> <tr> <td class="coverFile">src</td> <td class="coverBar" align="center"> <table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="ruby.png" width=39 height=10 alt="39.2%"><img src="snow.png" width=61 height=10 alt="39.2%"></td></tr></table> </td> <td class="coverPerLo">39.2 %</td> <td class="coverNumLo">399 / 1019</td> <td class="coverPerLo">32.8 %</td> <td class="coverNumLo">22 / 67</td> </tr> </table> </center> <br> <table width="100%" border=0 cellspacing=0 cellpadding=0> <tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr> <tr><td class="versionInfo">Generated by: LCOV version 1.10</td></tr> </table> <br> </body> </html> I am attempting to parse out the data from this line: <td class="headerCovTableEntryLo">39.2 %</td> as 39.2 (a float value). I am currently using this regex to find two matching TD's: <td class="headerCovTableEntryLo">[0-9.].*?.%<\/td> I'm misunderstanding how groups work. I tried: (<td class="headerCovTableEntryLo">[0-9.].*?.%<\/td>)[0-9.].*?\1 To take what was found in the first group and grab just the numberical values but I have zero matches. Can anyone lend some insight into what I am doing wrong?
Is this what you want to perform? (capture only the floating value): <(td) class="headerCovTableEntryLo">([0-9.]+)\s?%<\/\1> see it working here: https://regex101.com/r/qprROm/2 If so, if you try to reuse the first match you're making correct use of it with \1 or to etc to match which captured group. but in your trial you also captured the class which wont match in closing tag. Not sure this is really what you try to do though. haha Plus, in this case doing <(td)>(.*?)<\/\1> does not really make sense. It is more usefill if your usecase is something like this <(td|th|tr)>(.*?)<\/\1> In the end if I was doing it I would rather do it this way for more flexibility: (?<=class="headerCovTableEntryLo">)([0-9.]+)(?=\s?%) See it working here: https://regex101.com/r/qprROm/3
reverse column order in zurb-ink
in desktop view I want to align the image column to the right and the text column to the left, but in mobile view the image should be on top how can I reverse the order of the columns? <row> <columns small="12" large="6" class="text-container text-left small-text-center"> <h1 class="text-left">Title</h1> <p>Copy</p> <button href="zurb.com">Meer weten</button> </columns> <columns small="12" large="6" class="collapse visual-container"> <img src="assets/img/item-2.jpg" alt="" class="small-float-center float-right"/> </columns> </row>
Use the dir attribute. <table class="row" dir="rtl"> <tr> <td class="wrapper" dir="ltr"> <table class="four columns" > <tr> <td class="center" align="center"> <center> <img class="center" src="http://placekitten.com/g/600/600" width="128" height="154" alt="Majestic Kitty" /> </center> </td> <td class="expander"></td> </tr> </table> </td> <td class="wrapper last" dir="ltr"> <table class="eight columns"> <tr> <td> <p>Lorem ipsum dolor sit amet, beatae deserunt!</p> </td> <td class="expander"></td> </tr> </table> </td> </tr> </table> This shows the content left to right on desktop but the image on top on mobile. Solution found here: http://zurb.com/university/lessons/get-your-responsive-emails-in-order
Regex to eliminate many lines of text with an known start and stop string
I am attempting to eliminate all of the text between two specific strings of text with a single regex command. The original text looks like this: <html> <!-- template name: text.tpl --> <head> <title>Cross-Collection Search</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script src="/t/text/textclass.js" language="JavaScript"></script> <link rel="STYLESHEET" type="text/css" href="/t/text/textclass.css"> <link rel="stylesheet" href="/t/text/textclass-specific.css" type="text/css"> <script src="/t/text/bbagWindow.js" type="text/javascript" language="javascript"></script> <script type="text/javascript" language="javascript"> <!-- window.name = "mainwindow"; //--> </script> </head> <!-- -------------------------------------------------- --> <body bgcolor="#FFFFFF" marginwidth="0" marginheight="0"> <!-- -------------------------------------------------- --> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="54" class="hdrcolor" background="/t/text/graphics/hdr-bg1.gif"> <a name="top"></a> <img src="/t/text/graphics/umdlt-smbanner.gif" border="0"></td> <td height="54" class="hdrcolor" align="right" valign="top" background="/t/text/graphics/hdr-bg2.gif"> <table border="0" cellspacing="1" cellpadding="3"> <tr> <td align="right" nowrap valign="top" bgcolor="#CCCCCC"> <font size="-1"><a class="globnav" href="">Authorized user login</a></font> </td> <td align="right" bgcolor="#FFCC66" nowrap> <font size="-1"><a class="globnav" href="javascript:popupBBagWindow( 'http://ecfr.gpoaccess.gov/cgi/t/text/text-idx?c=ecfr;c=sampletc;cc=ecfr;xc=1;sid=75189253ab69c67a4a0484a5acb0c128;page=bbaglist' , true )">View bookbag</a></font> </td> </tr> </table> <font class="navinfo" size="2"><br>your bookbag has <strong>0</strong> items</font> </td> </tr> <!-- BEGIN rows outlining the navigation proper --> <!-- this row contains a table controlling layout for the top border lines of the navbar --> <tr> <td class="navcolor" colspan="2" align="left" height="1" nowrap> <table border="0" cellspacing="0" cellpadding="0"> <tr> <!-- home --> <td width="70" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <td width="1"><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <!-- search --> <td width="90" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <td width="1"><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <!-- browse --> <td width="75" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <!-- blankspace --> <td width="75" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <!-- help --> <td width="75" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> </tr></table> </td> </tr> <!-- this row contains a table controlling layout for the nav tabs themselves --> <tr> <td class="navcolor" colspan="2" align="left" bgcolor="#666699" height="23" nowrap> <table border="0" cellspacing="0" cellpadding="0"> <tr> <!-- home --> <td width="70" height="23" align="center" nowrap><font class="navlinks" color="#ffffff">Home</font></td> <!-- search --> <td width="90" height="23" align="center" nowrap><font class="navlinks" color="#000000">Search</font></td > <!-- browse --> <td width="90" height="23" align="center" nowrap><font class="navlinks" color="#ffffff">Browse</font></td > <!-- blankspace --> <td width="50" height="23" align="center" nowrap> </td > <!-- help --> <td width="70" height="23" align="center" nowrap><font class="navlinks" color="#ffffff">Help</font></td > </tr> </table> </td > </tr> <!-- this row contains the table that controls layout for the lower nav border lines --> <tr> <td class="navhrcolor" colspan="2" align="left" height="1" nowrap bgcolor="#999999"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="70" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <td width="1"><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <td width="90" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <td width="1"><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <td width="75" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> <td width="75" height="1" align="center" nowrap><img src="/t/text/graphics/plug.gif" width="1" height="1" border="0"></td> </tr></table> </td> </tr> </table> <table cellspacing="0" cellpadding="5" width="100%"> <tr> <td valign="top" nowrap> <hr size="1"> </td> </tr> </table> <table cellspacing="0" cellpadding="15"> <tr> <td> <br> <strong><span class=mainheader> The completed text after a regex search and replace needs to look like this: <html> <strong><span class="mainheader"> For some reason, just using the following does not work. Why? <html>(.*)<strong><span class=mainheader>
You probably need dot-all mode on (to make . matches new line character), or just replace . with [\s\S] (which ensures that all characters are matched regardless of whether your language support dot-all mode or not).