Bug 986 - Leading "\b" word boundary is ignored
Summary: Leading "\b" word boundary is ignored
Status: CLOSED FIXED
Alias: None
Product: Regexp
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Jakarta Notifications Mailing List
URL:
Keywords:
: 2371 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-03-15 09:39 UTC by Ed Chidester
Modified: 2004-11-16 19:05 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.