Regexp ^$

Posted by Vaejor on Thu 13 Jun 2002 12:55 PM — 5 posts, 17,923 views.

#0
It appears as though the Regexp ^$ doesn't correctly match to an empty line.

Is it possible for it match correctly?
Australia Forum Administrator #1
Which version are you using? I think there might have been a bug in an early version where blank lines didn't go through trigger matching or something like that. However I think it works now. Also, are you sure it is blank (try packet debug)? Maybe it has a space in it. You might need:

^[ ]*$
#2
I'm currently using version 3.22.

I checked the packets, and found only (the equivalent of)
chr(13) & chr(10) & chr(13) & chr(10)
in each position where I saw a blank line.

I also just tried ^[ ]*$ but that did not gag the empty lines.
Australia Forum Administrator #3
Ah yes, I remember now. :)

It didn't work a while ago, and because I thought someone might be relying on it, I made it an option, can't remember the exact reason. ;)

Go to:

File -> Global Preferences -> General

and check:

"Regular expressions can match on an empty string"

I think it is because it is an option inside the regular expression suboutines, that "no match" (ie. nothing at all returned) is considered "not a match", even in the case that you present, where you are specifically searching for an empty string. The option in question lets the regexp parser consider an empty string a match.
#4
Ah, there it is.

Thanks, Nick.

Makes gagging the output from specific commands work fully now, so I can just use the information I've grabbed from them.