Andreas Saeger wrote:
Having lines like:
Para 1
Para 2 Line 1<shift+enter>
Para 2 Line 2
Para 3


A single $ _as an OOo-specific exception to the rule_ matches a paragraph break itself. But in general $ marks the position behind the last char in a line, not including any char. In other words: $ marks the position where you get hitting the End-key, ^ marks the position where you get hitting the Pos1-key. ^P.+[0-9]$ matches a "P" *behind* the start of line(^P), followed by at least 1 any-char (.+), followed by a digit *before* the end of line([0-9]$. When you replace this with something the line-breaks are untouched.
A single ^ as search-expression never matches anything.
& and \n seem to be the only regex-symbols allowed in replace-expressions. The following paragraph from the infamous list of OOo-regexes is unclear about that and the last sentence is plain wrong:
$ This symbol represents the paragraph mark for use in a regular expression. For example, using $ will only find the search term if it appears at the end of a paragraph. So, if one searches for, say, Peter at the end of a paragraph, enter Peter$ in the Search for box. Special characters (for example, blank spaces and character-anchored frames) at the end
  of a paragraph are ignored.

Add a space at the end of a line. It won't be ignored by ^P.+[0-9]$
\n matches a line break in search-context, but it is a paragraph break in replace-context. Another expression matching a line break is \x000A (hexadecimal 10), which comes in handy if you like to match only this kind of lines. Beware of named character classes [:digit:], [:alnum:] and alike. They are slightly broken by OOo-design. According to the rules ' [0-9]'(leading space) matches a space, followed by a single digit, whereas ' [:digit:]' does not match anything at all. ' [0-9]? matches a space, followed by one optional single digit and so does ' [:digit:] As far as I can tell, named character classes fail if they are the only or the last element of a regex. This is an accepted issue, targeted for OOo3.
I should have said, "How do I replace two consecutive end-of-line characters with one EOL character?".

Sorry for not being more specific!

--
Pete Holsberg
Columbus, NJ

Maxim for the Internet Age: You can't teach an old mouse new clicks.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to