Javascript Split Include Delimiters
I have the following regular expression: (?[a-z][a-z0-9]*[^<>]*>) I have the following text:
Hello Mister! How are
Solution 1:
I actually agree with Omar on this issue, but I'll give you the regex anyway. :)
\<[^>]+?>|.+?(?=(?:<[^><]+?>|$))
Solution 2:
This was mentioned for infinite times. Regex is not the right tool to do that. Regex is good with small, short and finite amount of text. The likes of checking and validating user input.
I would suggest that you learn more about the browser DOM model. Each tag is an object in the DOM, and can be selected with JavaScript, and also referenced. You can play with your data that way.
Solution 3:
Cannot test right now, but what about
/(<\/?[a-zA-Z]+([^"]|"(\\.|[^"])*")*>)|([^<]|<[^a-zA-Z])*/
Post a Comment for "Javascript Split Include Delimiters"