Bug 986

Summary: Leading "\b" word boundary is ignored
Product: Regexp Reporter: Ed Chidester <echid>
Component: OtherAssignee: Jakarta Notifications Mailing List <notifications>
Status: CLOSED FIXED    
Severity: normal CC: dana.peters, shawn_heller
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: other   

Description Ed Chidester 2001-03-15 09:39:09 UTC
Using regexp Version 1.2 on either Solaris 2.6 or WinNT 4 and versions 1.1.7 
and 1.3 of Sun's JRE.

Any pattern with a leading "\b" boundary has that boundary ignored.

For example, If I make an RE object from the String "\\bfly\\b" (==> /\bfly\b/ )
that object will correctly fail to match the string "flying" but
will incorrectly match the string "housefly"
Comment 1 Michael DeCorte 2001-06-26 10:29:14 UTC
If I understand the code correctly (big if), the following should fix this 
problem:

change RE.java line 1050 from

    char cLast = ((idx == getParenStart(0)) ? '\n' : search.charAt(idx - 1));

to

    char cLast = ((idx == 0) ? '\n' : search.charAt(idx - 1));


Comment 2 Michael McCallum 2001-09-08 15:44:35 UTC
This is not necessary for posix compliance but if the given fix works I will
integrate it.
Comment 3 Michael McCallum 2001-09-08 15:58:09 UTC
*** Bug 2371 has been marked as a duplicate of this bug. ***
Comment 4 Shawn Heller 2002-06-25 21:30:25 UTC
ran into this problem personally.  I integrated the fix into the src for 1.2 
and the patch does work properly.
Comment 5 Jon Stevens 2002-12-13 18:13:28 UTC
patch added. tests added and tested. 
Comment 6 Jon Stevens 2002-12-13 18:13:42 UTC
closed.