I want to find the unscaped characters in some XML input in order to replace them with their escape sequences through my code.
For instance, my XML input would consist unescaped and escaped & characters in it. What i want to achieve is that find only all the unescaped & characters and replace them with '&' i.e. their escape character.
I have thought of using pattern matching in Java to solve this problem and have ofund out the pattern &[a-z]+; would help find all the escape sequences in the XML input.
however, i am not able to create a pattern for finding the unescaped & characters in the XML input.