At 13:05 2002.01.16, Leon wrote:
>- Original Message -
>From: <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Cc: <[EMAIL PROTECTED]>
>>
>> | $key=~/^r(\d+)c(\d+)$/
>> ||\___/|\___/|
>> || | | | ` end of string
>> || | | `--- one or more digits => $2
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
>
> | $key=~/^r(\d+)c(\d+)$/
> ||\___/|\___/|
> || | | | ` end of string
> || | | `--- one or more digits => $2
> || | `-- the letter
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 th
The regex you gave will match on every $key that consists of:
- the beginning of the string
- immediately followed by the lowercase letter 'r'
- immediately followed by one or more digits,
which are stored in $1
- immediately followed by the lowercase letter 'c'
- immediately follow
As I understand this it would be without verifying in the books noted below:
/^r any line where the first character is a lowercase "r"
(\d+) followed by any number of numeric characters, stored in
internal var \1
c followed by a lowercase "c"
(\d+)$/ followed b