how to convert a string
"<br><br><br><br><br><br>" to "<br>" using java String.replaceAll(String, String) method?
I tried both:
str.replaceAll("<br>+","<br>"); str.replaceAll("<br>{1,}","<br>);
but does not work.
<br>+ matches "<br>>>>>>>>" , try instead: (<br>)+
<br>+
"<br>>>>>>>>"
(<br>)+
And if there are spaces between the tags, do:
str = str.replaceAll("(<br>\\s*)+","<br>");
Source: https://habr.com/ru/post/1412251/More articles:Android NDK - include C ++ header in another header? - javaRunning OS on VirtualBox - assemblyUsing an IN clause versus multiple SELECTs - phpHow can the bootloader read DVD (cd)? - assemblymulticolored canvases LineTo - html5How can I assign a character variable number in MATLAB? - matlabHow to add an indicator to UIImagePickerController - iosSet annotation name as current address - iosAccidentally brought out a keyboard shortcut for org-columns in org em ems mode and now wants to get rid of the column representation at the top of the buffer - emacsHow to create an element with a raised tab, like the one found on Instagram or Dailybooth using css / html - htmlAll Articles