I am working on a project that uses a text editor to generate styles content behind the scenes and updates the value of an hidden input with the html contents.
A component has been developed for a specific version of this text editor with a focus on uploading a single image only. When uploading a single image as needed, the input value will be structured as follows:
<input id='image' type='hidden' value='<p><img src="some url"></p>' />
I'd like to generate some regex that will grab the hidden input value and validate for this <p><img src='...'/></p>
structure and disqualify any other structure. i.e. multiple images from being uploaded into the editor, any text surrounding the image after upload, text only without any image, etc.
Is this possible to achieve with regex? something like:
methods: {
isValidImage(inputValue) {
//validate with regex
return isValid;
}
}
Thanks in advance