I am converting 4-white-space to single-tab in BBEdit using grep. I am converting white space in Python code to tabs. Following works fine:
find:[^\S\r]{4} replace:\t
However, why the following is removing carriage return. Should not it give the same result.
find:\s{4} replace:\t
[^\S\r]{4}
means "4 characters being either not (not whitespace) or not carriage return: you can simplify it as "4 chars (whitespace or not carriage return)".
But carriage return matches whitespace. So negating \r has no effect: it can be furthermore simplified as 4 whitespaces actually equivalent to \s{4}
So you asked for [\t\n ]{4}
But that doesn't make sense, as no tabulation, carriage return or newline chars should be replaced in your case
you probably want [ ]{4}
: 4 explicit space characters only.