Answer the question
In order to leave comments, you need to log in
Javascript filtering repeated tags
Hello. I'm trying to assemble a wysiwyg editor for myself and, for the purity of the generated code, I generate the insertion of tags manually. I don't know how to filter out extra tags in this situation:
<b>Просто знать шаги <b>недостаточно</b>. Надо <i>чувствовать</i> музыку.</b>
<b></b>
Here, around the word "not enough"
are superfluous . How can this be filtered out? Answer the question
In order to leave comments, you need to log in
Dơ͖̦̖̺̬͚͓̐͋ͭп̲͍͈o̳̘͉̤͑l̴͓̞̺̯̫͚ͣ̃̓ͮ̀̈́н̞͕̲̓͊ͬͬ̈́͟ю̽̇̓ͤͮͨ ̜̳͎͕̬̎̃о̢͌mlv͛͛т . If you use the regular ID for HTM L, then you will need to be a throat .L͉͇͊̌͋͌̓̾͛̚ ͉̹̣ͭ̑ͪ͜Ḧ̵̵̸̢̡̢̡̢̛̛͔͓͇͔͓͇͇̤̤̥̰͇̤̤̥̰̭̦͍͚̯͈̗̺͖͕̳̩͍͔̫̭̣̜͉̼͊̈͊̓ͫͬ̓ͫͬͦͪ̏̽̏ͭ̒̒͐̌̌̌̐ͪ̉ͬ̔ͮ̓, Ch̵̜̺͙͇̫͕̳̋͋̅̔͠t̵̵̸̸̶̢̢̳̫̖̝͚͈̘̳̫̖̝͚͈̘̭̜̪̳̭̜̪̳̭̣͙̭̣͙̭̯͓̮͖͚͖̭̯͓̮͖͚͖̳͇̹̝͈̯̠͍̠͖̯̠͍̠͖̤͍͕͓͈̬̺͖̯̯ͬ͛ͤͥͬ͛ͤͥ̑͊ͭͭ̈ͥ̑͊ͭͭ̈ͥ̍̑̊̉ͣ̍̑̊̉ͣ̾ͪ̌̉̾ͪ̌̉ͯͯ͊̌ͦ̏ͤ̾ͬ̾ͬ͗̓ͧ̒̋ͭ̒̋ͭͧͤ͛ͪ͛ͪͣͨͯ̍̒͒̑̕̕͘͘͡͡͏͎̭̪̬ͣͨͯ̍̒͒̑͡͏̷͎̭̪̬ͤͣͦͪ͑͟҉̴̵̢̣͔͉̦̠̝̯̟̰̦̜̯͈̤̝̗̞̦̜̯͈̤̝̗̞̣͍͉͖̪͇̜̫͇̯̝͉͎̖̳͕̣͎͎̖̳͕̣͎ͭ͐͛͛̏̏̽̋͊̍ͤͣͦͤͣͦ̆̆͑ͮ̍ͬ̆͋̈͋ͬ̆͋̈͋͟͟͞͠ ̴̸̧̥̘̟͍̓ͫ͒͊͌̓̐̊̈͛͋ͭ̔҉̴̸͓͚͖̙̥̦̥̙͙̟̮̣̦̫̐̊̈͛͋ͭ̔҉̶̨͓͚͖̙̥̦̥̙͙̟̮̣̦̫̝̭͎͔̪̼̳̯̳̼̭͍̗̣̮͖̯̠̦͉̺͍͕͕̮̼͍͚̟̹̹̌̓͆ͣ̍͗ͩͯ̏ͫ̍̌̑ͣͤ̔̌̊͌̌ͣ̈̿̄͋̔͒͒̊͊̐̄ͬͮͣ̌͆̓̒̏̄̈̓͗̆̌̽̈̆̒ͬ̚̕̕͟͞͡͞͞҉̸̴̴̶̡̧̡̡̡̡̙͇̝͓̼̦̭͓̠͚̰͙̯̖̹̣̦͎͚̣͔̤͉̞̠̞̦̞̮͍̭̹̮̘̹̮͍̩̼͓̠̥̳̜̤̣̼̫͓̠̥̳̜̤̣̼̫̪̘̖͇̰̠͔̻̰̳̩̟̪̘̖͇̰̠͔̻̰̳̩̟̳̦̺̫̄ͭ̏̉͑ͭ̾͆ͫ͐̍̄̉ͨͬ̔ͣͮͨ̐͊͆ͮ͐̿̓ͯ̓ͯͤ̾̈ͥ̈ͦ̑͑ͫͥ͛ͤͨ̐͋͋̅ͬ͊̈ͦ̑͑ͫͥ͛ͤͨ̐͋͋̅ͬ͊ͧ̑̈ͫͬ̉̏̾ͣ͌̔ͤͧ̽͗͋ͮͧ̑̈ͫͬ̉̏̾ͣ͌̔ͤͧ̽͗͋ͮ̾͗ͧ̾̓͊ͤ̊̒̑̚̕̕͢͜͟͡͡͝҉̦̖̟̺͕͔͖͍͕̰̥̭͚̑͜͝҉̦̖̟̺͕͔͖͍͕̰̥̭͚͜͝
. _
use a regular expression, but you will have to rack your brains)
var str = "<b>Просто знать шаги <b>недостаточно</b>. Надо <i>чувствовать</i> музыку.</b>";
str.replace(/<b>(.+)<b>(.+)<\/b>(.+)<\/b>/gi, "<b>$1$2$3</b>");
Slko, your answer is not displayed correctly, could you write again?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question