N
NvrBst
I want to match sections in a multilined string. For example
-----TEXT File-----
SECTION
hello this is my section
it can use SECTION or ENDSECTION if I want it to
and can be multi lined
ENDSECTION
SECTION
Another Section, can be any amount of sections in a file
ENDSECTION
-----EOF-----
AKA: I want a pattern which will match "^SECTION$" then anything but
"^ENDSECTION$" and then "^ENDSECTION$". I have the following: Note:
My "$" are actually "\r?$", but I kept them as "$" so they are easier
to read.
--Attempt One---
@"^SECTION$.*^ENDSECTION$", RegexOptions.Multiline |
RegexOptions.Singleline
--Problem--
It matches the first "^SECTION$" and the very last "^ENDSECTION$". I
want it to match the next "^ENDSECTION$" not the last.
--Attempt Two---
@"^SECTION$[^(ENDSECTION)]*^ENDSECTION$", RegexOptions.Multiline
--Problem--
The [^(ENDSECTION)] is matching like [^ENDSECTION]; the parenthesis
are not doing anything. "^" and "$" also have to go around it.
How would I match any character/word/etc except the pattern
"^ENDSECTION$", or maybe the word "\nENDSECTION\n" if it is easier?
Thanks.
-----TEXT File-----
SECTION
hello this is my section
it can use SECTION or ENDSECTION if I want it to
and can be multi lined
ENDSECTION
SECTION
Another Section, can be any amount of sections in a file
ENDSECTION
-----EOF-----
AKA: I want a pattern which will match "^SECTION$" then anything but
"^ENDSECTION$" and then "^ENDSECTION$". I have the following: Note:
My "$" are actually "\r?$", but I kept them as "$" so they are easier
to read.
--Attempt One---
@"^SECTION$.*^ENDSECTION$", RegexOptions.Multiline |
RegexOptions.Singleline
--Problem--
It matches the first "^SECTION$" and the very last "^ENDSECTION$". I
want it to match the next "^ENDSECTION$" not the last.
--Attempt Two---
@"^SECTION$[^(ENDSECTION)]*^ENDSECTION$", RegexOptions.Multiline
--Problem--
The [^(ENDSECTION)] is matching like [^ENDSECTION]; the parenthesis
are not doing anything. "^" and "$" also have to go around it.
How would I match any character/word/etc except the pattern
"^ENDSECTION$", or maybe the word "\nENDSECTION\n" if it is easier?
Thanks.