Apache OpenOffice (AOO) Bugzilla – Issue 114976
Find & replace regular expression behaves strangely
Last modified: 2013-02-06 20:04:13 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.
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.
reassigned; please have a look.
Reassigned to SBA
Confirmed using Rev. 1400866.