Hello, @bob-johnson, @terry-r and All,
OK, Bob. Luckily your S/R does not change the columns order, as you just want to replace 1 char with a single char, too. So, given the sample text below :
Column 4455555555 8901234567 0 ABCDE VWXYZ - 12345 # - at column 48 0 ABCDE VWXYZ - 12345 # - at column 49 0 ABCDE VWXYZ -BCDEFG 12345 # - at column 50 0 ABCDE VWXYZ A-CDEFG 12345 # - at column 51 0 ABCDE VWXYZ AB-DEFG 12345 # - at column 52 0 ABCDE VWXYZ ABC-EFG 12345 # - at column 53 0 ABCDE VWXYZ ABCD-FG 12345 # - at column 54 0 ABCDE VWXYZ ABCDE-G 12345 # - at column 55 0 ABCDE VWXYZ - 12345 # - at column 56 0 ABCDE VWXYZ - 12345 # - at column 57The following regex S/R :
SEARCH (?-s)^.{49}.{0,5}\K-
REPLACE .
Tick the Wrap around option
Click on the Replace All button
And choose, of course, the Regular expression search mode
It should modify the text, as expected :
Column 4455555555 8901234567 0 ABCDE VWXYZ - 12345 # - at column 48 0 ABCDE VWXYZ - 12345 # - at column 49 0 ABCDE VWXYZ .BCDEFG 12345 # - at column 50 0 ABCDE VWXYZ A.CDEFG 12345 # - at column 51 0 ABCDE VWXYZ AB.DEFG 12345 # - at column 52 0 ABCDE VWXYZ ABC.EFG 12345 # - at column 53 0 ABCDE VWXYZ ABCD.FG 12345 # - at column 54 0 ABCDE VWXYZ ABCDE.G 12345 # - at column 55 0 ABCDE VWXYZ - 12345 # - at column 56 0 ABCDE VWXYZ - 12345 # - at column 57Notes :
The first part (?-s) forces the regex engine to consider that dot ( . ) represents a single standard char only ( Not an EOL one )
The special syntax \K, cancels any previous search, already matched, at current location of the regex engine and, in your case, just consider the last - character
Best Regards,
guy038