I have been trying to find how I can query the first sentence only of a paragraph within a field (HTML code) for SQL Server but I am unable to find how. I have found solutions for MySQL using the SUBSTRING_INDEX
and I have also found solutions returning a certain number of words/characters but not using a specific delimiter.
My field is stored as HTML, an example is as follows:
<html><body>Enter the following page information.<br><br>
<b>Display #:</b> 1 [Automatically Populated]<br>
<b>Start Page: </b> 1 [Automatically Populated]<br>
<b>DCI Name:</b> DEMOG<br>
<b>Clinical Planned Event:</b> BASELINE1<br>
<font color="#0070C0">TAKE A SCREENSHOT</font>.<br>
</body></html>
In this example, I am hoping to only return/query "Enter the following page information" and not the rest of the paragraph. I'm assuming the HTML break might be the best delimiter as some sentences may end in a colon.
Thank you in advance! I hope I explained the scenario well enough.