I have an HTML content and I do this to get the Textual content .
string='<img src="Randomz" alt="Randomz Image">Randomz is the name of the image</img><img src="Randomz" alt="Randomz Image">Randomz is the name of the image</img><img src="Randomz" alt="Randomz Image">Randomz is the name of the image</img><img src="Randomz" alt="Randomz Image">Randomz is the name of the image</img>'
re=(/([<][^<]+>)([^<]+)([<][^<]+>)/g);
newstr=string.replace(re,"$1$2$3");
This give me back the original string.
My problem is that I need to apply another string.replace(regex,$2) before newstr=string.replace(re,"$1$2$3")
That is, I need to apply another regex on the parametrized catch before applying the final solution.
Not sure what you’re doing here, but I guess you’re looking for
replacecallbacks:As a side note, regular expressions is not the best tool for html transformations.