Ok, I'm not a regexp expert but trying out the recommend suggestion ([:space:]?){8} had OOo writer searching and finding all instances where there was *1* or more consecutive spaces (up to 8).
It found occurances where there was only 4, only 6 etc.... So if this was used, based on the original question, it would find 8 spaces and replace with 4, it would then find 1 space and replace with 4... well at least this is what it did when I tried it.
I may have the wrong end of the stick here, but this is what happened when I tried it.
Regards,
Paul
On Wed, 26 Jan 2005 09:09:25 -0500, Paul B. <[EMAIL PROTECTED]> wrote:
David Teague wrote:
I have some C++ code with annoyingly many spaces of indentation.
I want to replace the leading 8 spaces with 4. If I use eight of the regular expression [:space:]?, as
[:space:]?[:space:]?[:space:]?[:space:]?[:space:]?[:space:]?[:space:]?
and replace with say four of them, the find button in the find command (Control F) finds every space, not just the 8 space instances.
I want only to replace instances of 8 spaces with 4 spaces.
How do I do this?
(I was just told about the regular expression to match the beginning of a line, so I do know about that.)
David Teague Viva Fifths tuning for Double Basses
That seems to work here, but you might try enclosing it in parentheses, or better, a more concise nomenclature:
([:space:]?){8}
Paul
You're right. Sorry about that. As someone here pointed out, the presence of "?" indicates 0 or 1 hits on the preceding phrase. I think the Help file needs tweaking on this point. Use ([:space:]){8} instead, or even [:space:]{8}.
Paul
-- Using OOo m69 on WinXP. Given address is infrequently checked. Please reply to group.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
