Environment:
CentOS 4.2 (RHES4 clone)
Ruby 1.8.4
Rails 1.0
I am having a small difficulty with case sensitive matching in some
ruby code:
f_nam_re = Regexp.new(f_nam_re_s,“x”)
produces these test results:
The passed regexp: ^QPCCCMR[[:digit:]]$
The regexp used is:
/^QPCCCMR[[:digit:]]$/i
$= is false
qpcccmr1 matches
QPCCCMR1 matches
QPCCMMR1 does not match
qpCCCMR1 matches
QPCCCMRC does not match
QPCCCMR1.csv does not match
QPCCCMR9 matches
XXQPCCCMR9 does not match
QPCCCMR9yyy does not match
XyZQPCCCMR3AbC does not match
However, just removing the “x”
f_nam_re = Regexp.new(f_nam_re_s)
Produces this from the same test suite:
The passed regexp: ^QPCCCMR[[:digit:]]$
The regexp used is:
/^QPCCCMR[[:digit:]]$/
$= is false
qpcccmr1 does not match
QPCCCMR1 matches
QPCCMMR1 does not match
qpCCCMR1 does not match
QPCCCMRC does not match
QPCCCMR1.csv does not match
QPCCCMR9 matches
XXQPCCCMR9 does not match
QPCCCMR9yyy does not match
XyZQPCCCMR3AbC does not match
So, why does enabling regexp extensions force case insensitivity?
Further, once it is turned on in this fashion I cannot seem to get
it switched off even when using the (?-i:) construct.
I would very much appreciate a direct copy of any reply to the list
as I subscribe to the digest version of.
Regards,
Jim
–
*** e-mail is not a secure channel ***
mailto:byrnejb.@harte-lyne.ca
James B. Byrne Harte & Lyne Limited
vox: +1 905 561 1241 9 Brockley Drive
fax: +1 905 561 0757 Hamilton, Ontario
= hal Canada L8E 3C3