Guest User

Untitled

a guest
Jul 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. some text <p id='item_1' class='item'>multiline contentrnrn for <br/>remove</p><br clear='all' id='end_of_item_1'/><p id='item_2' class='item'>another multiline contentrnrn</p><br clear='all' id='end_of_item_2'/>
  2.  
  3. <p id='item_1' class='item'>multiline contentrnrn for <br/>remove</p><br clear='all' id='end_of_item_1'/>
  4.  
  5. var id = 'item_1';
  6. var patt=new RegExp("<p id='"+id+"'(.)*|([Ss]*?)end_of_"+id+"'/>","g");
  7. var str="some text <p id='item_1' class='item'>multiline contentrnrn for <br/>remove</p><br clear='all' id='end_of_item_1'/><p id='item_2' class='item'>another multiline contentrnrn</p><br clear='all' id='end_of_item_2'/>";
  8. document.write(str.replace(patt,""));
  9.  
  10. some text for
  11. <br>
  12. remove
  13. <p></p>
  14. <br id="<p id=" class="item" clear="all" item_2'="">
  15. another multiline content
  16. <p></p>
  17. <br id="end_of_item_2" clear="all">
  18.  
  19. var s = "some text <p id='item_1' class='item'>multiline contentrnrn for <br/>remove</p><br clear='all' id='end_of_item_1'/><p id='item_2' class='item'>another multiline contentrnrn</p><br clear='all' id='end_of_item_2'/><ul><li>";
  20. var id = 'item_1';
  21.  
  22. var patt = new RegExp ("<p[^<>]*\sid=['"]" + id + "['"](?:.|\n|\r)*<br[^<>]*\sid=['"]end_of_" + id + "['"][^<>]*>", "ig")
  23.  
  24. var stripped = s.replace (patt, "");
  25.  
  26. "some text <p id='item_2' class='item'>another multiline content
  27.  
  28. </p><br clear='all' id='end_of_item_2'/><ul><li>"
  29.  
  30. var item1 = document.getElementById('item_1'),
  31. endOfItem1 = document.getElementById('end_of_item_1');
  32.  
  33. item1.parentNode.removeChild(item1);
  34. endOfItem1.parentNode.removeChild(endOfItem1);
  35.  
  36. <ps+id='([a-zA-Z0-9_]+)'.*?id='end_of_1's*/>
  37.  
  38. var patt=new RegExp("<ps+id='"+id+"'.*?id='end_of_"+id+"'s*/>","g");
Add Comment
Please, Sign In to add comment