I know how to do regex etc. and everything works fine for me, but im stuck now when one of the things i need to find are not in the same line, they are structured one per line.
example of how it is in in the website source:
<li class="test"><div style="background-color:blue">Hello</div></li> <li class="test"><div style="background-color:blue">Hello1</div></li> <li class="test"><div style="background-color:blue">Hello2</div></li>
basically i need only those "Hello", "Hello1" etc., so i have this regex which finds this pattern:
"<li class='test'><div style='background-color:blue'>(.+?)</div></li>"
And it works fine, it finds those "Hello" etc. which i want to find, but the problem is that i need ALL of them to be collected and put in one line seperated by commas in certain structure
To put the results in a multiline textbox, i use something like:
textBox1.Text = Environment.NewLine + textBox1.Text + Environment.NewLine + "[start]" + Environment.NewLine + "string is: " + m.Group[1].ToString() + Environment.NewLine + "[end];
which prints out in layout like this:
[start] string is Hello [end]
But the problem is, that I want it to put that "Hello", "Hello1" and "Hello2" in same line seperated by commas like this:
[start] string is Hello, Hello1, Hello2 [end]
What ever I try I just can't get it to work, the way it does it for me is like this...:
[start] string is Hello [end] [start] string is Hello1 [end] [start] string is Hello2 [end]
I know it's easy to do in php using "foreach" but it doesnt work for me on C# :S
Can someone pelase help me out here?
thanks.


Sign In
Create Account


Back to top









