1

I am working to create a connector app between a client database and an external web system. This will prevent daily double entry of notes to the web page. The external system is an old asp site. I do not have acces to their code. They do not offer an API.

I have all of the connecter app working with the exception of clicking the link associated with the "Notes" that need updating.

Basically, if you picture an HTML table that looks like this:

[3/3/2017][category][      Notes           ]
[2/5/2015][category][    correspondence    ]
[1/5/2013][category][       records        ]

The HTML link is on the date, not on the word "Notes" nor "correspondence", or "records". Some tables have up to 8 rows. The notes row isn't always on top. There is no way to sort it to the top. Since the

I want to click the date link that corresponds to the word "Notes"

I have tried countless regex queries on the underlying HTML code with no luck. Anyone have any suggestions on how I can get this done?

Here is the HTML as requested:

<a href="weblink.com">10/26/2016</a>
</td>
    <td height="20" align="center" nowrap> Open</td>
    <td height="20" align="center" nowrap>10/26/2016</td>
    <td height="20" align="center" nowrap></td>

    <td height="20" width="331">Notes<br>
    </td>
</tr>

<tr >

    <a href="weblink.com">1/13/2017</a>
    <td height="20" align="center" nowrap> Open</td>
    <td height="20" align="center" nowrap>10/26/2016</td>
    <td height="20" align="center" nowrap></td>

    <td height="20" width="331">Correspondence<br>
</td>
</tr>
BradI
  • 11
  • 3
  • 1
    **Regex is basically never the answer when working with HTML.** That being said, to give any source of assistance, it would be helpful see the source code of the table. You should probably look into something like [The HTML Agility Pack](http://htmlagilitypack.codeplex.com/) for DOM Parsing. – Regular Jo Mar 04 '17 at 19:55
  • 1
    Based on your comment, I looked up parsing HTML and found great responses in [this gem](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags) – BradI Mar 04 '17 at 22:39
  • I'm glad you researched it. Most people refuse to believe that regex isn't the solution, as if some of the masters of it would lie.the easiest way to capture a tag, for instance, is `<\w [^>]*>` but then that's banking on the attributes never containing a closing bracket. You can permit closing brackets within attributes, but then that's banking on the quote-qualifier never being in the attribute or if it is, it's escaped and it gets to be a whole ridiculous mess when solutions like jQuery/jSoup make the process simple and reliable. **Have a good day!** – Regular Jo Mar 04 '17 at 23:58
  • Please show the full HTML for this table including the rows and/or cells within that contain the link that you want to click. Not sure what Regex has to do with this question yet, but we shall see if you post the HTML of the table. – darbid Mar 05 '17 at 11:19
  • Ok, I have added the HTML to the post. – BradI Mar 06 '17 at 21:04

0 Answers0