How do I create character blocks of specified length?
-
I was curious if there was a way to get the program to break large continous blocks of text (stuff converted to base 64, for example) into blocks of characters of a specified length so that they can be easily copied and pasted.
For example:
/9j/4AAQSkZJRgABAgAAAQABAAD/7QCcUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAIAcAmcAFHd0cks2MHpnR3R5a3pHYVNvNVZrHAIoAGJGQk1EMDEwMDBhYzEwMzAwMDAyYTI1MDAwMDZiNDYwMDAwM2U0OTAwMDA5ZjRiMDAwMGRkNWUwMDAwYmRhYzAwMDBlM2I0MDAwMDgzYmIwMDAwNzhjMTAwMDA4MjYzMDEwMP/iAhxJQ0NfUFJPRklMRQABAQAAAgxsY21zAhAAAG1udHJSR0IgWFlaIAfcAAEAGQADA
to
/9j/4 AAQSk ZJRgA BAgAA AQABA AD/7Q CcUGh vdG9z aG9wI DMuMA A4Qkl NBAQA AAAAA IAcAm cAFHd 0cks2 MHpnR 3R5a3 pHYVN vNVZr HAIoA GJGQk 1EMDE wMDBh YzEwM zAwMD AyYTI 1MDAw MDZiN DYwMD AwM2U 0OTAw MDA5Z jRiMD AwMGR kNWUw MDAwY mRhYz AwMDB lM2I0 MDAwM DgzYm IwMDA wNzhj MTAwM DA4Mj YzMDE wMP/i AhxJQ 0NfUF JPRkl MRQAB AQAAA gxsY2 1zAhA AAG1u dHJSR 0IgWF laIAf cAAEA GQADA
-
Use search & replace i.e.
- Ctrl-H
- Find what: ([\w/]{5})
- Replace with: \1
- Search mode: Regular expression
- Ctrl-A (Replace All)
-
Sorry, that didn’t work out i.e. trailing space not visible …
- … as above
- Replace with: "
\1
" i.e. backward-slash + one + space - … as above
-
Hello Andrew,
An other formulation, which separates any text in blocks of five characters long, whatever they are, would be :
SEARCH
.{5}(?=.)
REPLACE
$0\x20
Notes :
-
The
.{5}
syntax matches for five consecutive standard characters -
I added the look-ahead form
(?=.)
, just to ensure that NO extra-space will be added, at the end of each long-line scan -
The
$0
syntax represents the match of the whole regex, that is to say, any block of five characters -
And
\x20
is, simply, the hexadecimal form of the space character
Best Regards,
guy038
-