JS uses rules to write a sentence to determine whether to repeat tags continuously.

for example, a string is

    

<br/><br><br/><br><br/><br><br/><br><br/><br>

how to write the rule replaces the final result of the string with

Hello,

I"m my brother. < br/ >

?

Jun.23,2022

let str = '

<br/><br><br/><br><br/><br><br/><br><br/><br>' str = str.replace(/(

<\/p>)*/g, '$1') str = str.replace(/(<br\/><br>)*/g, '$1')


var reg = /(<\/?([A-Za-z]+\/?)>)+/g;
str.replace(reg,'<$2></$2>');


var reg = /(<([a-zA-Z]+)\/?><\/?\2\/?>)\1{1,}/g;
var s = /(<hr\/?>)\1{1,}/g;
str.replace(reg,function(){
  var f = arguments[2];
  return (f=='br'?'<br/>':'<'+f+'></'+f+'>')
}); //
str = str.replace(s,'$1'); //hr
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37807-2c090.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37807-2c090.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?