Chas Owens wrote:
On 7/16/07, yitzle <[EMAIL PROTECTED]> wrote:
> [ and ] define a character class and ^ means something different inside a
> character class.  You need to use alternation instead.
>
> =~ /(?:^|&)limit=([0-9]{1,3})(?:&|$)/

I thought ^ inside [] only meant 'something special' if it was the
first character.

When ^ isn't the first character in a class it means nothing special.
That is the problem.  Outside of a character class it means
start-of-string* which is special.

* or start-of-line if the m option is set, or either if both the m and
s options are set.

^ always represents the start-of-line whether the /m option is used or not.

perldoc perlre
[ snip ]
           ^   Match the beginning of the line
[ snip ]
           \A  Match only at beginning of string

The /s option has no effect on what ^ matches.



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to