Alright, I have the following string:
--------------
Info
Info
Info
Info
Info
Info
--------------------
The string is several lines of information (all about one item) then a blank line. Then a series of information about another item,
etc, etc.
I'm trying to split this into each different section using the regular expression:
^$ (with multiline turned on)
This works fine in the tools "The Regulator" and "The Regex Coach". It splits (more-or-less) right where it should. However, when
I actually run the split in my code, it does not separate, but instead returns only 1 "section" (of the entire string). Any ideas
what might be causing this?
Here's the C# code:
RegexOptions options = RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline | RegexOptions.IgnoreCase;
Regex typeReg = new Regex("^$", options);
string []sections = typeReg.Split(str); //str is a string read in from the data file
Another problem I'm noticing when using those tools (a problem that I would like to get rid of), is that the newlines are present
from the split points. Is it possible to split there and also remove those newlines (so my sections don't have extraneous pieces to
them)?
Thanks!
--
Adam Clauss
ca*****@tamu.edu