ansi_c
asked on
Strip first comment
I have this
<!-- Generated by abcdefg --><p>sdsdsd</p>
I need to remove the first comment that is <!-- Generated by abcdefg --> and leave the rest intact.
Hopefully, I need to use regex.
<!-- Generated by abcdefg --><p>sdsdsd</p>
I need to remove the first comment that is <!-- Generated by abcdefg --> and leave the rest intact.
Hopefully, I need to use regex.
Without regex:
Dim myString As String = "<!-- Generated by abcdefg --><p>sdsdsd</p>"
myString = myString.Substring(myStrin g.IndexOf( "-->") + 3)
Dim myString As String = "<!-- Generated by abcdefg --><p>sdsdsd</p>"
myString = myString.Substring(myStrin
ASKER
No. It's always changing.
And I want a regular expression solution.
And I want a regular expression solution.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you might want to limit that a bit, if you only have "A-Z" in the list with no spaces
data = Regex.Replace(data, @"^<!-- Generated by \w* -->", String.Empty);
string removed = data.Replace("<!-- Generated by abcdefg -->", String.Empty);