Issue 110755 - Unable to Find & Replace Regular Expression $ with \t Tab
Summary: Unable to Find & Replace Regular Expression $ with \t Tab
Status: CONFIRMED
Alias: None
Product: Writer
Classification: Application
Component: editing (show other issues)
Version: OOo 3.2
Hardware: PC Windows, all
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-09 23:50 UTC by ppww
Modified: 2014-04-06 11:58 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ppww 2010-04-09 23:50:38 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.
Comment 1 eric.savary 2010-04-09 23:53:09 UTC
Reassigned to SBA
Comment 2 ppww 2010-04-09 23:58:25 UTC
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.
Comment 3 rgb 2010-09-18 22:49:54 UTC
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
Comment 4 Edwin Sharp 2014-03-13 08:29:36 UTC
Confirmed with
AOO410m14(Build:9760)  -  Rev. 1573601
2014-03-03 17:47:48 (Mo, 03 Mrz 2014)
Win 7
Comment 5 Rainer Bielefeld 2014-04-06 11:58:27 UTC
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