yitzle wrote:
I know this isn't the best way to parse it, but I need to check the
$ENV{'QUERY_STRING} for some values.
I originally had   =~ /^limit=([0-9]{1,3})$/   which worked. But I
tried to replace the ^ with [&^] and the $ with [&$] to allow the
string to be part of a longer string attached with an & on either
side.
The point is, the [&^] doesn't seem match either ^ or &, like I want to.
Why is this? How do I match ^ or &?
(I really should just split on & and grep or whatever, but...)

[ and ] define a character class and ^ means something different inside a character class. You need to use alternation instead.

=~ /(?:^|&)limit=([0-9]{1,3})(?:&|$)/



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