This is my last try to explain you how to replace spaces in some columns. I have posted twice correct search strings always with a single space between the round brackets and at end of the search string and you consistently ignore my search strings and use search strings not containing any space character. I epxlained twice very detailed the expressions, but you do not follow my explanations and create search strings where the spaces which should be replaced by underscores are matched also by the expressions inside the round brackets. That can't work and that's not what I have written. Please follow my suggestions.
- Code: Select all
Time Date D Zone R Zone Source Address My Address
can be changed to
- Code: Select all
Time Date D_Zone R_Zone Source_Address My_Address
only by using search string (without double quotes):
"
^(.{11
}) (.{6
}) (.{11
}) (.{10
}) " <- my string is longer because of the 4 spaces
"
^(.{11
})(.{8
})(.{11
})(.{11
})" <- your string is shorter because of missing the spaces and wrong character multiplier numbers
My search string contains 4 spaces - 3 single spaces between the round brackets and one at end. Your search string does not contain any space character. My search string matches with expression in second round bracket just 6 characters. Your search string matches 8 characters and matches therefore also the space character before and after string
Zone R which should be replaced. And same mistake is made also for fourth expression.
The replace string is
\1_
\2_
\3_
\4_
As last chance for you to understand that the space characters to replace must be outside the round brackets, I post here a screenshot with additional red color marking the 4 spaces present in search string which are replaced by 4 underscores.

- Replace dialog for replacing space characters at column 12, 19, 31 and 42.
- replace_spaces.png (9.27 KiB) Viewed 402 times