Answer the question
In order to leave comments, you need to log in
How to compose regex for C#?
There is a line snippet:
много таких кусков вверх
<div class="commentthread_comment_text" id="comment_content_546947">
TEXT TO FIND </div>
</div>
<div class="forum_comment_permlink">
<a href="#c8645777">#34</a>
много таких кусков вниз
Answer the question
In order to leave comments, you need to log in
You just need to start from">#34<?a>
up to cut off to the nearestStringBuilder stringb= new StringBuilder(string_); int pos = stringb.ToString().IndexOf(@""">#34");//" stringb.Remove(pos, stringb.ToString() - pos);//Убираем всё, что после pos = stringb.ToString().LastIndexOf(@"<div class=""commentthread_comment_text"" id=""comment_content_546947"">");//Ищём "div class="... выше "">#34 stringb.Remove(0, pos);//Убираем всё, что выше string_ = stringb.ToString();
regexr.com?37pou
regexr.com?37pp1
But in general it is better to parse with special parsers
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question