faqts : Computers : Programming : Languages : Tse : Editing

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

TSE: Column: Align: Left: How to align left column, using regular expression?

Oct 3rd, 2004 11:47
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 26 September 2004 - 05:50 pm ------------------

TSE: Column: Align: Left: How to align left column, using regular 
expression?

---
---

Method: Replace with regular expression

---

Steps: Overview:

 1. -Highlight the column you want to align

 2. -Use e.g. a replace regular expression to move the
     spaces in the back to the front.

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

      PROC Main()
       LReplace( "^{[ ]*}{[~ ]*}\c$", "\2\1", "glxn" )
      END

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

 3. -This basically states:

      1. start at the begin of column

      2. get all space characters

      3. then get all non space characters
         (check this until the end of the column)

      4. exchange these

---
---

Note this regular expression assumes the elements your column are not
at the end of the line, as it does not see any spaces on the right, but
only 'end of lines'

To avoid this, for example copy the orginal column on the right of it
temporarily, then do the align, then remove this temporary column.

---
---

Help: see also:

 format() command in TSE

---
---

Internet: see also:

---

TSE: Column: Sort: Numeric: How to: How to possibly do a numeric sort 
of a column using TSE?
http://www.faqts.com/knowledge_base/view.phtml/aid/31450/fid/1707

---

TSE: Column: Align: Right: How to align right column, using regular 
expression?
http://www.faqts.com/knowledge_base/view.phtml/aid/31632/fid/904

----------------------------------------------------------------------