hankknight
asked on
ASP.NET/VB/REGEX: Decive content in half by lines
Using ASP.NET/VB and Regular Expressions, how can I turn this:
1
2
3
4
5
a
b
c
d
e
Into this:<span class="cols">
<span class="col1">
1
2
3
4
5
</span>
<span class="col2">
a
b
c
d
e
</span>
</span>
I want the content to be devided in exactly half.
input = RegularExpressions.Regex.Replace(input, ???, "<span class=""cols""><span class=""col1"">$1</span><span class=""col2"">$2</span></span>")
ASKER
Thanks, I should have made my example better reflect my need. The first half of lines should go in the first group and the second half of lines should go in the second group. In the wild this will be more complicated than just numbers and letters.
This should be in the first group.
1st group is where this line should be.
"Line 3" should be in the first group
Line 4 belongs in the second group
This line should be in group 2
This last line goes in group two.
should become:<span class="cols">
<span class="col1">
This should be in the first group.
1st group is where this line should be.
"Line 3" should be in the first group
</span>
<span class="col2">
Line 4 belongs in the second group
This line should be in group 2
This last line goes in group two.
</span>
</span>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
See it in action