On Sep 22, Michael Gale said:

Jeff 'japhy' Pinyan wrote:

On Sep 22, Michael Gale said:

I have the following line of code and I believe it is correct, but it is not doing what I am expecting it to do:

Config file
[test]
value=^OK$i

The problem is that '^OK$i' as a string turned into a regex is a regex that can never match. The '$' is the end-of-string anchor, so there's no way an 'i' can match after it. Were you hoping the '$i' would be expanded to the current value of the $i variable?

I was hoping that $ would mean the end of the string and "i" would mean case insensitive :(

To do that, use (?i) instead:

  value=(?i)^OK$

Alternatively, you could just write

  value=^[Oo][Kk]$

but that gets unwieldy as the regex grows in size...

--
Jeff "japhy" Pinyan        %  How can we ever be the sold short or
RPI Acacia Brother #734    %  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %    -- Meister Eckhart

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


Reply via email to