I have a string in this format:
<!--Start 498-->
some stuff here
<!--End 498-->
<!--Start 498-->
some more stuff here
<!--End 499-->
and so on.
How can I split this string to remove the content between a certain block of <!--Start xx->
and <!--End xx-->
?
For example, if I wanted to remove the text between <!--Start 500-->
and <!-- End 500-->
, how would I remove it?
Edit: What regexp can I use to replace these? I'm hopeless with Regexps :(
From stackoverflow
-
I'd use String.replace with a regular expression to match the blocks and replace with an empty string
Something like
<!--Start \d+-->.*?<!--End \d+-->
would do the trick
Click Upvote : Can you post a reg-exp I could use? I'm hopeless when it comes to regexps..Perspx : It's never too late to learn!: https://developer.mozilla.org/En/Core_JavaScript_1.5_Guide:Regular_Expressions -
http://www.webreference.com/js/column5/rules.html would help.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.