Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var test_string_html = '<strong><i>more</i> <span style="color: red">complicated</span></strong>';
- var count = 7;
- test_string_html_2 = test_string_html.split(/<.*?>/gi);
- test_string_html_3 = test_string_html.split(/>.*?(?=<)/gi);
- test_string_html_4 = test_string_html_2.join("").slice(0,count);
- var test_string_html_5 = "";
- for( i = 0; i < test_string_html_3.length; i++){
- test_string_html_5 += test_string_html_2[i] + test_string_html_3[i] + ">";
- }
- console.log(test_string_html);
- console.log(test_string_html_2);
- console.log(test_string_html_3);
- console.log(test_string_html_4);
- console.log(test_string_html_2.length);
- console.log(test_string_html);
- console.log(test_string_html_5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement