Reputation: 1
I am trying to index solar search from a built string in a code which has HTML tags. Any one knows how I can remove all the characters from the String.
Currently, I am using
answers << answer.feedback.replaceAll('\\<.*?>','')
I want to escape all the HTML characters and all the \n \t and \r. How to do this?
Upvotes: 0
Views: 1266
Reputation: 1575
Do you want to escape the html tags so that <span> becomes <span> or do you want to REMOVE the tags themselves. Your original question is ambiguous.
For the first scenario:
answer.feedback.encodeAsHTML()
(see http://grails.org/doc/latest/ref/Plug-ins/codecs.html for further info)
Upvotes: 1