Dale <mailto:[EMAIL PROTECTED]> wrote:
: Hi Jeff 'japhy' Pinyan, you wrote:
: : : if ($line =~ /^[\s\d]+$/) { ... }
: : Can I just check something here Jeff. I thought the ^ symbol was for
: "not equal", so why does this work when I'm looking for digits?
A circumflex (^) means "not" inside a character class. [a-c] and [^a-c] are character classes. The first represents characters a, b, or c and the second represents all characters which are not a, b, or c.
> In a regular expression, a circumflex (^) is used as an anchor for > the beginning of the string being matched. The end of the string anchor ^^^^^^ ^^^^^^ > is "$". > > So $line above, must begin (^) with either \s or \d ([\s\d]) and > continue (+) to the end ($) of the line.
Just to be technically correct, ^ and $ are line anchors and with the /m option will match a line inside a string. The string anchors are \A, \Z and \z. Without the /m option ^ behaves the same as \A and $ behaves the same as \Z. :-)
John -- use Perl; program fulfillment
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>