Apache OpenOffice (AOO) Bugzilla – Issue 110755
Unable to Find & Replace Regular Expression $ with \t Tab
Last modified: 2022-10-22 14:12:49 UTC
I'd like to append a tab, followed by additional text (the digit 1), to the end of each line of a selection. In the Find & Replace dialog, I enter Search for: $ Replace with: \t1\n (Regular expressions checkbox selected) But this appends a literal "\t1" to the end of each line, instead of the tab character. Same with \x0009, which inserts those literal characters instead of the tab control character. Workaround: Search for: (.*)$ Replace with: $1\t1 A few more possible bugs are evident when using the workaround: The back-reference \1 does not work, it must be $1. The expression does not find blank lines, even though the any-character (.) is optional (*). And in the workaround case, it is not necessary to include \n in the replacement, as the newline is not removed by the search expression. (The newline is removed if only $ is specified as the search. Inconsistent behavior.) My reference is http://wiki.services.openoffice.org/wiki/Documentation/How_Tos/Regular_Expressions_in_Writer#The_.27Replace_with.27_box_.5Ct_.5Cn_.26_.241_.242 which indicates that \t, \x0009 and \1 etc. are supposed to work in replacement expressions. \t does work as a replacement in cases other than a single $ search, but \x and \1 seem never to work as described. \n in the replacement works as expected in all cases that I've tried.
Reassigned to SBA
Addendum: Sorry, ignore the comments about \1 and \x failing in replacement. I understand now that those match in the search expression only. The main point, that \t fails, is still valid.
I can confirm this on both, 3.2.1 and DEV330m8: \t introduce a tab for any replaced text EXCEPT when it replace an end of paragraph, in which case it introduce "\t" as text
Confirmed with AOO410m14(Build:9760) - Rev. 1573601 2014-03-03 17:47:48 (Mo, 03 Mrz 2014) Win 7
Really a crazy thing, works anywhere fine, only if the \t is the first in the replace pane and $ the last in the find pane the problem appears
Confirmed with actual AOO 4.1.3, 4.2 dev and 4.5 dev As Workaround use "AltSearch" from the AOO extensions site. https://extensions.openoffice.org/en/project/alternative-dialog-find-replace-writer-altsearch