I have an html string parsed in android froom a spannable string. :-
<p dir="ltr"><b><b><b><b><b>qwert</b></b></b></b></b><b><b><b><b><b><b>y</b></b></b></b></b></b></p>
As you can see, there are multiple occurences of tags.
Now i have done hit and trials ,user methods like replaceAll(), but they replace all occurences.
What i want is that, when i pass a substring to find, lets say "<b>", and then it should replace, lets say the first five consecutive bold tags in the above string with a single "<b>" tag.
Any Suggestions
Required Result :- <p dir="ltr"><b>qwert</b><b>y</b></p>