views:

234

answers:

2

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 :(

+2  A: 

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

David Caunt
Can you post a reg-exp I could use? I'm hopeless when it comes to regexps..
Click Upvote
It's never too late to learn!: https://developer.mozilla.org/En/Core_JavaScript_1.5_Guide:Regular_Expressions
Perspx
A: 

http://www.webreference.com/js/column5/rules.html would help.

BYK