Don't put the question marks in the expression. What you want is just [:space:][:space:][:space:][:space:][:space:][:space:][:space:][:space:].

A question mark means "match this character 0 times or 1 time only". What is happening for you is that for every space character in your document, one of your [:space:]? is matching the space and the other seven are perfectly content not to match anything at all.

Without the question marks, every single one of the eight [:space:] is required to match one and exactly one space character, all one after the other.

"Beginning of line" won't help you with the question marks still in the expression; it'll find any number of space characters from 0 to eight at the beginning of EVERY line. Yes, I mean every line; every line has at least 0 space characters at the beginning.

If you have more questions, reply directly to me as well as the list. I recently unsubscribed because I couldn't keep up with the volume.

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





---------------------------------------------------------------------
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