I am parsing a poorly structured rss feed, and some of the data that is being returned has <p>at in it. How can I replace all instance of <p>at with an empty space, using java?
I'm familiar with the .replace method for the String class, but I'm not sure how the regex expression would look. I tried inputString.replace("<p>at", "") but that didn't work.
Try this:
inputString = inputString.replace("<p>at", "");
Be aware that the replace() method does not modify the String in-place (as is the case with all methods in the String class, because it's immutable), instead it returns a new String with the modifications - and you need to save the returned string somewhere.
Also, the above version of replace() doesn't receive a regular expression as an argument, just the string to be replaced and its replacement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With