Issue 75214 - Writer - regex "[\t|\n]+" does not find neither tab, nor end of paragraph
Summary: Writer - regex "[\t|\n]+" does not find neither tab, nor end of paragraph
Status: CLOSED DUPLICATE of issue 46165
Alias: None
Product: Writer
Classification: Application
Component: ui (show other issues)
Version: OOo 2.2 RC2
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: stefan.baltzer
QA Contact: issues@sw
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-07 20:39 UTC by kpalagin
Modified: 2007-03-08 17:01 UTC (History)
1 user (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 kpalagin 2007-03-07 20:39:28 UTC
Searching for "[\t|\n]+" does not find tab, space, or end of paragraph (EoP). 
Repro steps:
1. Open Writer, random text including "t", press tab and Enter (to enter end 
of paragraph character).
2. Press Ctrl-F to open S&R dialog, click "More Options" and check "Regular 
Expression".
3. Enter "[\t|\n]+" (no quotes) in "Search for" and click Find. Note how "t"'s 
are found, but not tabs or EoP.
Comment 1 kpalagin 2007-03-07 20:52:12 UTC
(Corrected summary)
Comment 2 michael.ruess 2007-03-08 09:08:29 UTC
Reassigned to SBA.
Comment 3 stefan.baltzer 2007-03-08 16:47:19 UTC
SBA: The string inside the square brackets, is "treated differently". In this
case it is NOT  interpreted as regular expression. A good example (see list of
regular expressions) is the "^":

"[^a-s]" finds any character that is not between a and s.
"^a-s" finds the string "a-s" when it is at the beginnig of a paragraph.

In your case, the \n and \t INSIDE the brackets are NOT interpreted as hard line
break but as "find the letters n and t". 

Clarification:
For Search Strings:
\n = "New Line" = A hard Line break, entered with <Shift>+>Enter>. With
"nonprinting characters visible", it looks like a tiny broken arrow, just like
the one on the "Enter" Key on regular Computer Keyboards.
$ = "Paragraph End", entered with <Enter>. With "nonprinting characters
visible", it looks like a "mirrored P" with two vertical lines.

For replace strings:
\n in "Replace Feld" adds a Paragraph break. 

I admit that this is not very intuiitive. This is good old (OK, very old) code.
I know that the regular expression handling already triggerd a nice pile of
enhancement or feature requests. A search for "Regular Ex" OR Regex" AND "State=
NOT closed" brings up 30 results (Defects, enhancements and features). Most of
them have target OOo Later, thus developers from the community shall feel free
very welcome to make things better in this area.

I regard issue 46165 as a good "survivor" for the problem with combining regular
expressions.
I put the findings here into that one and put kpalagin on c/c of that one.

Set to duplicate. 


*** This issue has been marked as a duplicate of 46165 ***
Comment 4 stefan.baltzer 2007-03-08 17:01:37 UTC
SBA: Closed.