I have basic editor which allow the user to enter notes. I am using the https://quilljs.com/ API for the editor. The content of the editor will be saved in a database, but before that persisting the data, I want to sanitize the HTML content, to remove all possible JavaScript events in Oracle PL/SQL. I am not able to get a regular expression to sanitize the HTML content before saving.
Example: <p>This is <a href="http://www.test.com" rel="noopener noreferrer" target="_blank">www.test.com</a></p><p>ffffff</p><p><br></p><p><br></p><p>Review at <a href="http://www.1159pm.com" rel="noopener noreferrer" target="_blank" **onclick="alert()" ondblclick="alert()" onmouseover="alert()" onkeypress="alert()"**>www.1159PM.com</a> </p><p>fffffff</p>'
Expected Result: <p>This is <a href="http://www.test.com" rel="noopener noreferrer" target="_blank">www.test.com</a></p><p>ffffff</p><p><br></p><p><br></p><p>Review at <a href="http://www.1159pm.com" rel="noopener noreferrer" target="_blank">www.1159PM.com</a> </p><p>fffffff</p>'
All Js events removed. Other scripts and styles should be removed as well. Please help me with the Oracle RegEx to solve this problem.