jakarta-regexp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kurt Westerfeld" <k...@ManagedObjects.com>
Subject RE diffs for case-insenstive bug
Date Tue, 20 Jun 2000 14:37:10 GMT
If I create a regular expression using the expression "foo" with case
independence turned on, the RE class will not match "Foo", nor will it match
"the Foo".

The problem seems to be related to some "prefix optimization" code I found.
If a prefix match is to be performed, the code does not match the prefix
when the case independent flag is on.

Here's a patch. for this

1490a1491
>             boolean caseIndependent = (matchFlags & MATCH_CASEINDEPENDENT)
!= 0;
1494c1495,1500
<                 if (search.charAt(i) == prefix[0])
---
>                 boolean match = false;
>                 if (caseIndependent)
>                     match = Character.toLowerCase(search.charAt(i)) ==
Character.toLowerCase(prefix[0]);
>                 else
>                     match = search.charAt(i) == prefix[0];
>                 if (match)
1502c1508,1512
<                         if (search.charAt(i++) != prefix[k++])
---
>                         if (caseIndependent)
>                             match =
Character.toLowerCase(search.charAt(i++)) ==
Character.toLowerCase(prefix[k++]);
>                         else
>                             match = search.charAt(i++) == prefix[k++];
>                         if (!match)


________________________________________________________________________
  Kurt Westerfeld
  Managed Objects Incorporated
  7925 Westpark Drive
  McLean, VA  22102
  Phone: 703.770.7225
  Fax: 703.208.3331
  http://www.ManagedObjects.com
  mailto:kwester@ManagedObjects.com



Mime
View raw message