I have these tags in my textarea
<gras>.....</gras>
And I'm trying to replace them using the replaceAll() String method
text.replaceAll("<gras>", "<b>");
text.replaceAll("</gras>", "</b>");
But, this regex code doesn't work. Any help please ?
Strings don't replace. Strings construct new Strings with the replacement values.
Also, if you are dealing with XML, regex is the wrong tool. That doesn't mean it can't work, and it might be useful in some limited examples, but it shouldn't be the first tool to use. Much like a hammer shouldn't be the first tool to use when installing a screw.
replaceAll(which uses regular expressions) instead ofreplace?\<and\>.