Forum Moderators: open

Message Too Old, No Replies

Help with Regular Expressions

         

digitalv

3:14 am on Apr 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm familiar with using a Regular Expression to replace text within a string, but I'm trying to figure out how to use it to replace text BETWEEN two strings.

Anyone have any ideas how to do this?

I want to replace everything between:

<!-- BEGIN -->

and

<!-- END -->

coffeebean

9:45 pm on Apr 25, 2005 (gmt 0)

10+ Year Member



string ResultString = null;

ResultString = Regex.Replace(SubjectString, "(<!-- BEGIN -->)([\\s\\S]+)(<!-- END -->)", "$1Replacement text here$3");

Courtesy RegexBuddy [regexbuddy.com]