-1

so i am trying to capture a specific value from email html.The part of email is,

enter image description here

i want to capture 9/7/2018 from email the HTML source of the part containing this date is:

<table cellspacing=
=3D=220=22 cellpadding=3D=220=22 width=3D=22200=22 border=3D=220=22 align=
=3D=22left=22 class=3D=22left innertable=22 style=3D=22background:=23ffffff=
;border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;=22>
                                                            <tr>
                                                                <td width=
=3D=22200=22 align=3D=22left=22 valign=3D=22top=22 style=3D=22line-height:2=
2px; font-size:20px; font-family: Arial, sans-serif; color:=232a2a2a; text-=
decoration:none;=22>Date of Purchase:</td>
                                                            </tr>
                                                        </table>
                                   =20
                                                        <table cellspacing=
=3D=220=22 cellpadding=3D=220=22 width=3D=22288=22 border=3D=220=22 align=
=3D=22right=22 class=3D=22right innertable=22 style=3D=22background:=23ffff=
ff;border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;=22>
                                                            <tr>
                                                                <td width=
=3D=22200=22 align=3D=22right=22 valign=3D=22top=22 style=3D=22line-height:=
22px; font-size:20px; font-family: Arial, sans-serif; color:=23636363; text=
-decoration:none;=22>

**9/7/2018**

</td>
                                                            </tr>
                                                        </table>
                                                       =20
                                                    </td>
                                                    <td width=3D=2250=22 cl=
ass=3D=22gutter=22></td>
                                                </tr>
                                            </table>
                                            <table cellspacing=3D=220=22 ce=
llpadding=3D=220=22 width=3D=22600=22 border=3D=220=22 class=3D=22table=22 =
style=3D=22background:=23ffffff;border-collapse:collapse; mso-table-lspace:=
0pt; mso-table-rspace:0pt;=22>
                                                <tr>
                                                    <td width=3D=2250=22 cl=
ass=3D=22gutter=22></td>

i am using c# regex match can used more than once (like for first expression we can find the whole tag containing the DATE and from second expression we can find the date from the Tag ) I tried some expressions but nothing worked for me.

Rana Jawad
  • 75
  • 1
  • 7

1 Answers1

0

First you have to parse your html into a string.

Now you can use Regex to find you date:

MatchCollection dateFound = Regex.Matches(YOUR_STRING_NAME, "[0-9]*/[0-9]*/[0-9]{4}");
Simo
  • 955
  • 8
  • 18