From: Davy on
Hi,

Is ^$ mean a NULL line?

Best regards,
Davy

From: Mirco Wahab on
Thus spoke Davy (on 2006-06-20 13:14):

> Is ^$ mean a NULL line?

No, its usually used for detection of
"lines with no characters in them"
(only the logical line feed \n is there)
in /m mode of a regex.


Regards

Mirco
From: Mirco Wahab on
Thus spoke Mirco Wahab (on 2006-06-20 13:25):

> "lines with no characters in them"

A made up example of how you would use it:


use strict;
use warnings;

my $count = 0;
my $text= <<END_OF_TEXT;
A Line with something in it


two empty lines above!
(done)
END_OF_TEXT

print "empty line " . ++$count . " found\n"
for $text =~ /^$/gm; # <== here we go



Regards

Mirco

From: Nick of course on

Mirco Wahab wrote:
> Thus spoke Mirco Wahab (on 2006-06-20 13:25):
>
> > "lines with no characters in them"
>
> A made up example of how you would use it:
>
>
> use strict;
> use warnings;
>
> my $count = 0;
> my $text= <<END_OF_TEXT;
> A Line with something in it
>
>
> two empty lines above!
> (done)
> END_OF_TEXT
>
> print "empty line " . ++$count . " found\n"
> for $text =~ /^$/gm; # <== here we go
>
>
>
> Regards
>
> Mirco
A slightly shorter answer to the original question would have been "Yes"

From: Dr.Ruud on
Davy schreef:

> Is ^$ mean a NULL line?


Nice riddle!

Can I ask yes/no-questions? If yes:
Is you read the posting guidelines?

Show us the effective code that uses that "^$". Where does it fail?

If you want to learn to use regular expressions, read perlre and
friends.

--
Affijn, Ruud

"Gewoon is een tijger."


 |  Next  |  Last
Pages: 1 2 3
Prev: Running system commands
Next: unicode