----------------------------------------------------------------------
--- Knud van Eeden --- 27 Juny 2007 - 02:02 pm -----------------------

TSE: File: Search/Replace: Regular expression: Line: Split: How to: After some given character (e.g. a comma) split a line in 2 parts, at a position a given amount of characters further?

===

Method: Regular expression search

Steps: Overview:

 1. -Given start character is a comma

      ,

 2. -Given total amount of characters
     after that comma

      35

 3. -Given the following block of text

--- cut here: begin --------------------------------------------------

aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890
aaaaaa,1234567890123456789012345678901234567890

--- cut here: end ----------------------------------------------------

 4. -Run the following search/replace action in TSE

     1. -Highlight that block of text

     2. -Select from menu option 'Search'

     3. -Select from list 'Replace'

     4. -Copy/paste or type the following search string
         in the 'Search for' box:


{,...................................}{.@}


         1. -That is:

              a '{'
              followed by a comma ','
              followed by 35 dots '.'
              followed by '}'
              followed by '{'
              followed by a dot '.'
              followed by a '@'
              followed by a '}'

     5. -In 'Replace with' fill in

              \1\n\2

     6. -In 'Search options' fill in

           glnx

 5. -What this regular expression thus does:

     1. -From the starting position of the cursor

         1. -It searches first for a comma

         2. -Then it searches for 35 any characters after
             that

         3. -Then it searches for 1 character more.

         4. -It takes 2. and 3. and puts a newline character
             between it, and replaces

             1. -That newline character forces TSE
                 by design to split the line at that
                 position

 5. -After the replace actions the block will look like
     this

--- cut here: begin --------------------------------------------------

aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890
aaaaaa,12345678901234567890123456789012345
67890

--- cut here: end ----------------------------------------------------

===


Source: Carlo Hoogeveen
Internet: see also:
 
---
 
Screencast: see also:
 
---
===
Image: see also:
----------------------------------------------------------------------