requirement is to replace the sensitive words in the HTML document. But I just want to replace plain text, and some html tags contain sensitive words, which I don"t want to replace. For example, the src of the img tag contains sensitive words, and if you replace the sensitive words in src, the picture will not be displayed.
for example,
it"s a nice day today. Abc
I want to replace abc with * .then replace it with
it"s a nice day today *
if I simply use Java"s String.replaceAll ("abc", https://api-v5.segmentfault.com/question/"*")
then you"ll get
it"s a nice day today *
, so the picture can"t be loaded, which is not what I want.
I"ve been thinking about it for a long time, and I"ve also thought about regularity. do you guys have any good ideas?