Issue 121633

Summary: some regular expressions fail unless "match case" is also ON
Product: Writer Reporter: Joe Smith <jes>
Component: codeAssignee: AOO issues mailing list <issues>
Status: ACCEPTED --- QA Contact:
Severity: Normal    
Priority: P3 CC: hdu, issues, jdaniel.alvaro, sebb
Version: 3.4.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: 3.4.1
Developer Difficulty: Medium
Issue Depends on: 121880    
Issue Blocks:    

Description Joe Smith 2013-01-16 17:29:53 UTC
The new ICU regex engine requires that letter case is significant in the pattern:
\S is different from \s ("non-space" and "space")
\B is different from \b ("non-boundary" and "boundary")
\p{Uppercase} is valid, \p{uppercase} is not

The "match case" option in Writer interferes with these patterns.

In Writer:
File > New
(type)dt(then)F3 -> dummy text paragraph

Edit > Find & Replace
Search for: \S
Match case: OFF
Options/regular expression: ON
Click: Find

Note that the pattern matches only spaces, where it should match non-space characters.

Change Match case: ON

Now the pattern works, matching non-space characters.

It seems that the "Match case" option must be on in order to preserve case in the pattern.

This is not correct, breaking some searches and giving wrong results in others.

The "match case" option should not affect the pattern itself, only how the match is carried out.
Comment 1 hdu@apache.org 2013-01-22 10:44:15 UTC
Confirming on AOO 3.4.1 and on todays AOO trunk version.
Comment 2 SVN Robot 2013-01-22 12:10:47 UTC
"hdu" committed SVN revision 1436862 into trunk:
#i121633# fix search for upper-case character classes in ignore-case regular ...
Comment 3 hdu@apache.org 2013-01-22 12:14:10 UTC
Thanks for catching this1 Please check with one of the next nightly builds at http://ci.apache.org/projects/openoffice/ when they successfully build a revision >=1436862.
Comment 4 SVN Robot 2013-01-22 13:07:03 UTC
"hdu" committed SVN revision 1436886 into trunk:
#i121633# fix ignore-case problem caused by i18nsearch API mess
Comment 5 Joe Smith 2013-02-05 15:29:30 UTC
Tested AOO350m1(Build:9611)  -  Rev. 1442201
2013-02-05_04:29:57-Rev.1442466
on Fedora Linux 17

Looks good; problem solved. All my tests I listed above seem to work as expected now.

Thanks so much for looking into this!
Comment 6 Joe Smith 2013-07-30 22:08:27 UTC
I don't know what's happened but this problem is NOT fixed in AOO 4.0 release.

Testing
AOO400m3(Build:9702)  -  Rev. 1503704
2013-07-16 11:18:40 (Tue, 16 Jul 2013) - Linux i686

Edit > Find & Replace
Search for: \Sa

finds only a's preceeded by a space--the pattern calls for non-space.

Tick "Match case" and it works properly.

Maybe the relevant patch did failed to go into the AOO 4 line?

I've changed the status to "REOPENED"; I hope that's right.
Comment 7 hdu@apache.org 2013-08-01 13:51:59 UTC
Yes, the fix for bug 121880 unfortunately reintroduced this problem again.
Comment 8 sebb 2013-08-01 14:10:15 UTC
Seems to me that any further fix should include a test case so it cannot happen yet again.
Comment 9 Joe Smith 2014-03-05 13:32:07 UTC
I'm still seeing this problem in dev builds of 4.1

AOO410m14(Build:9760)  -  Rev. 1573613
2014-03-04_02:13:02-Rev.1573839
Comment 10 Marcus 2017-05-20 10:45:09 UTC
Reset the assignee to the default "issues@openoffice.apache.org".