Issue 114976 - Find & replace regular expression behaves strangely
Summary: Find & replace regular expression behaves strangely
Status: CONFIRMED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: OOo 3.2.1
Hardware: Mac All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-07 09:10 UTC by juliandroms
Modified: 2013-02-06 20:04 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description juliandroms 2010-10-07 09:10:09 UTC
OOo 3.2.1 (OOO320m18) has Find & Replace feature that behaves strangely using
regular expression which has been present for more than a year.

I inadvertently thought this was a more over-arching problem, but it appears to
only occur in limited circumstances.

Using Find & Replace in a text document that has more than one paragraph:

(1)  Choose Find & Replace from the Edit menu.
(2)  Select "More options."
(3)  Check the "regular expressions" box.
(4)  Put "$" in the "Search for" box. - $ is reg exp for end of paragraph.
(5)  Put "\t" in the "Replace with" box.  - \t is reg exp for tab.
(6)  Select "Replace all".

Find & Replace will Find correctly the end of each paragraph, but will Replace
the paragraph break with the literal "\t" rather than the tab character that the
reg exp represents.

A workaround is to put ".$" in the "Search for" box and "$\t" in the "Replace
with" box, but this workaround is not particularly obvious.

Another quirk:

(4) Put "^" in the "Search for" box - ^ is reg exp for beginning of paragraph.

When searching for this reg exp alone, it does not identify any paragraph
breaks, whereas when searching for "$" alone does identify paragraph breaks. 
This may be intentional, but if so you may think about changing the
documentation ("list of regular expressions") to reflect the difference in the
two reg exp.

These types of searches are very useful for reformatting data for calc
spreadsheets.  I think it likely that I am not the only one using it for this
purpose.
Comment 1 juliandroms 2010-10-07 09:31:48 UTC
Actually where I said this...

> A workaround is to put ".$" in the "Search for" box and "$\t" in the
> "Replace with" box, but this workaround is not particularly obvious.

I should have said "&\t" rather than "$\t".   However, this only inserts a tab
next to each paragraph break.  If you are trying to replace paragraph breaks
with tabs, you will in addition have to remove the paragraph breaks afterwards.



Comment 2 Olaf Felka 2010-10-07 09:51:33 UTC
reassigned; please have a look.
Comment 3 eric.savary 2010-10-07 10:21:02 UTC
Reassigned to SBA
Comment 4 Edwin Sharp 2013-02-06 20:04:13 UTC
Confirmed using Rev. 1400866.