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: Right: How to align right column, using regular expression?

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


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

TSE: Column: Align: Right: How to align right 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 front to the back.

--- 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 non space characters

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

      4. exchange these

---
---

Note:

This regular expression assumes the elements in your column are not
at the end of the line, as it does then 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, so changing the end of lines temporarily to spaces, 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: Left: How to align left column, using regular 
expression?
http://www.faqts.com/knowledge_base/view.phtml/aid/31631/fid/904

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