To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=83938


User discoleo changed the following:

                What    |Old value                 |New value
================================================================================
                 Summary|replace all incorrect with|replace all incorrect with
                        | regular exp.             | regular exp.
--------------------------------------------------------------------------------




------- Additional comments from [EMAIL PROTECTED] Sun Nov 25 11:19:06 +0000 
2007 -------
The actual behaviour is correct! Are you sure you have done everything as stated
here?

Lets see what '^[^:]+:' does find:

NOTE: '^[^:]+:' is probably better than your '^.[^:]*:'

Your version will also find:
:this is some text beginning with a ':' ...further text...
^                                    ^
|                                    |
Selects from the start to this second colon!

My version will skip that line. [IF you wish only the first colon, use
'^[^:]*:]' instead.]

Now, what will the regular expression '^[^:]+:]' find?
Lets say we have:
   ...some text: more text: even more text

It will select form the beginning to the first ':'. Now IF you replace this
with, e.g. 'different text', then you end basically with:
   different text more text: even more text
so, the replace all will also find: 'different text more text:', and will
replace this, too:
   different text even more text
Now it has finished.

IF, however, you replace with '*:' (note the additional ':'), then this will not
happen, so your example would have been processed correctly, as you desired it.

Also, replacing with ' &' will produce the correct result, because '&' will also
paste the ':' from '^[^:]+:]'.

In conclusion, you code works correctly and, in the examples you give, should
provide even your desired results. IF however, you intend to replace with some
text that DOES NOT have a colon (aka without the ':'), the replace all is still
correct, but it is different from what you think it ought to do. In that
situation I can't imagine a simple one-click solution to your problem. But you
can solve it in 2 steps:
 - first, replace it with e.g. ':#the replacement text##'
   [NOTE: we use ':#' as markers for the replacement]
   [IF your text contains this particular string,
    consider a different strin, like '%%'
 - second: replace: ':#.*##' with the actual replacement

This should do it.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

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


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

Reply via email to