Bug 60838 - EDITING: Regular expression does not give consistent results on repeated search
Summary: EDITING: Regular expression does not give consistent results on repeated search
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: Other Windows (All)
: high major
Assignee: Not Assigned
Whiteboard: BSA
Depends on:
Reported: 2013-02-14 12:02 UTC by Zhivko
Modified: 2016-08-30 03:41 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:

libreofice document to reproduce bug (189.50 KB, application/vnd.oasis.opendocument.text)
2013-02-14 12:02 UTC, Zhivko
Find&ReplaceDialog (93.39 KB, image/png)
2014-10-06 06:51 UTC, Zhivko

Note You need to log in before you can comment on or make changes to this bug.
Description Zhivko 2013-02-14 12:02:51 UTC
Created attachment 74808 [details]
libreofice document to reproduce bug

Problem description: 

Steps to reproduce:
1. open libreoffice 
2. Load attached odt
3. Click search and replace
4. in search text enter check\((.*)+\)
5. Mark regular expressions
6. Click FindAll


Current behavior:
CPU goes to 100% and search operation never completes

Expected behavior:
search regular expression should be found without processor to go to 100%

Operating System: Windows 7
Version: release
Comment 1 Thomas van der Meulen [retired] 2013-02-15 09:29:50 UTC
thank you for reporthing this bug,
I can reporduce this bug running LibreOffice on Winows 7.
Comment 2 Zhivko 2013-03-26 14:06:43 UTC
This is quite critical - is it possible to get some estimation? Has anybody looked at this?
Thank you
Comment 3 retired 2014-03-15 20:16:54 UTC
Hi Klemen, I do not find "5. Mark regular expressions" in the latest nightly of LO.

Does this problem persist with 4.2.2?
Comment 4 QA Administrators 2014-10-05 23:05:57 UTC Comment hidden (obsolete)
Comment 5 Zhivko 2014-10-06 06:50:19 UTC
Yes it is still there However I cannot reproduce this in 4.2.2 version.
CPU doesn't go to 100%, but also check strings in document are NOT marked.
Comment 6 Zhivko 2014-10-06 06:51:17 UTC
Created attachment 107390 [details]

This is dialog to enter regexp text and issue regexp search
Comment 7 Matthew Francis 2014-10-28 12:20:13 UTC
To begin with, you probably wanted to search for "check\(([^)]+)\)", which works. The combination of "(.*)" and "+" mean that you are asking for "one or more of (any number of any characters)", which isn't sensible.

There is however a bug to be fixed here; updated reproduction instructions:
1) Load the attached document
2) Search for the regular expression "check\((.*)+\)" (without the surrounding quotes, and using "Find", not "Find All" - an instance will be found)
3) "Find" again (a long pause, then no further instance will be found)
4) Place the cursor back at the start of the document
5) "Find" again

Expected results:
- The instance that was found the first time should be selected

Actual results
- Nothing is found

This will continue until the contents of the "Search For" field are changed, after which the original search will magically start working again
Comment 8 Buovjaga 2014-10-28 12:42:29 UTC
(In reply to Matthew Francis from comment #7)

> Expected results:
> - The instance that was found the first time should be selected
> Actual results
> - Nothing is found

I confirm this. I had no problem with operation never completing, but it can take some CPU and maybe 10-30 secs.

Win 7 64-bit dev build Version:
Build ID: 14a2cfc27f86112469f2a2252bdc154ad8d3219f
TinderBox: Win-x86@42, Branch:master, Time: 2014-10-28_04:51:26
Comment 9 QA Administrators 2015-12-20 16:18:14 UTC Comment hidden (obsolete)
Comment 10 Zenaan Harkness 2016-08-30 03:41:10 UTC
I confirm that once ~2.4Ghz CPU core goes to 100% for about 7 seconds when step 6 (click FindAll) is done, LO5.3.0alpha 2016-08-25

BUT, after the 7 seconds, the appropriate highlighted search result is displayed.

Still seems like something pathologic is happening in the regex engine, but perhaps it's not as bad as it used to be.

Perhaps just a bad/ pathological regex.

As per comment #7 first suggested regex, that completes 'instantaneously' for me.

I can also confirm comment #7 step 3, but not comment #7 "Actual results - Nothing is found" - the same text is for me, found again.

So except for a long (~7 seconds) pause on the second "Find" I am experiencing none of the other problems in the latest LO.

Just checked also on LO5.2.0.4 stable. Same results for me as above.

Works for me.