"^$" regex does not work

  • Thread starter Thread starter Efi
  • Start date Start date
E

Efi

Hello,
I am trying to capture empty lines, for example :
1. ABCDEF
2.
3. abcdef

I would like to capture line number 2.

I am using the following regex - new
Regex("^$",RegexOptions.Multiline);

RegexBuddy captures the empty lines correctly why doesn't the regex
engine of .net manages to capture it ?

Thank you,
Efi
 
I'm not sure why that doesn't work but I could get the following to
work:

\r\n\r\n

It does seem a bit of a hack tho. Just make sure you have the
IgnoreWhitespace option on or a space would mess it up.

Kelly S. Elias
Webmaster
DevDistrict - C# Code Library
http://devdistrict.com
 
Thanks.

It works, but what is the difference between between what I wrote and
what you wrote, they mean the same thing,aren't they ?
Cryptik כתב:
 
Back
Top