The expression returns a true or false value, that is to say, it is checking
to see if $key matches the expression.

/^r(\d+)c(\d+)$/ 

Broken down that means,

^ - means it must be at the very beginning of the line
r - just means to look for an 'r', but because it is next to ^, it has to be
at the beginning.
(\d+) - means look for 'digit' or number characters, and the + specifies
that it must find at least one. otherwise it wouldn't match. The ( and )
mean to save anything it matches between them into the special variables $1,
$2, etc.
c - just means to look for a 'c',
(\d+) - same as above, except that it is next to the '$' at the end. which
means that the numbers must go to the very end of the line.

I hope that was enough detail, and that it helps you out.

Good Luck,

Joshua Colson
Systems Administrator
Giant Industries, Inc.
(480) 585-8714
[EMAIL PROTECTED]


-----Original Message-----
From: Jerry Preston [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 15, 2002 5:14 AM
To: begginners
Subject: need help to understand a regex


All,

I need to understand this regex in detail:

$key=~/^r(\d+)c(\d+)$/

Thanks for your help and time,

Jerry


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to