(1)  Have strings like  ABCD  and want  DCBA. Assume words are case-insensitive.

CHANGE P'@@@@' WORD M'4-1'

(1.1)  The same example, using a RegEx with "quantifier" notation for the number of letters:

CHANGE R'[A-Z]{4}' WORD M'4-1'

(2)  Have strings like ABCD and want  DCBA. Assume words are upper-case only.

CHANGE P'>>>>' WORD M'4-1'

(3)  Have strings like  ABCD  and want  ** AB-CD **

CHANGE P'>>>>' WORD M'`** ` 1-2 `-` 3-4 ` **`'


CHANGE P'>>>>' WORD M'1-2 `-` 3-4 P P`*`2'

(4)  Have  AB1234  and want  XY4321

CHANGE P'AB####' M"`XY` 6-3"

(5)  Have  XX1234  and want  XX4321  where  XX  are any existing characters

CHANGE P'==####' M"1-2 6-3"

(6)  Have  XX1234  and want  xx4321  where XX, xx are upper and lower case

CHANGE P'>>####' M"< 1-2 <> 6-3"

(7)  Have  AB1234  and want  A123

CHANGE P'AB####' M"1 3-5"

(8)  Have  AB1234  and want  123ABC

CHANGE P'AB####' M"3-5 1-2 `C`"

(9)  Have  AB1234  and want  BB234

CHANGE P'AB####' M"2 2 4-6"

(10)  Have strings like  AB*12/34  and want  AB1234*/  where * and / are some delimiters; we use 0 to “grab” all the column positions not otherwise specified and put them at the end, which are columns 3 and 6 in this example:

CHANGE P'@@=##=##' M"1-2 4-5 7-8 0"

(11)  Have ‘words’ of varying sizes; want to reverse first 3 characters and make upper case, then copy the rest of the string as-is. Example:  abc12XyZ    CBA12XyZ

CHANGE R'[a-zA-Z]+' WORD M"> 3-1 <> 4+"

(12)  Have ‘words’ of varying sizes; want to reverse first 3 characters and make upper case, then copy the rest of the string in reverse order in lower case. Example:  abc12xyz    CBAzyx21

CHANGE R'[a-zA-Z]+' WORD M"> 3-1 < \4+"

Example of mapping ‘short’ data

Have ‘words’ of varying sizes; want to reverse first 5 characters, and drop any characters after position 5.

CHANGE R'[a-zA-Z]+' WORD M"5-1"

What happens here if the word found is shorter than 5 characters?  Suppose the string found is  ABC. For mapping purposes, the string is treated in effect as if it were extended to the right with “null” characters, like this:


Then, the string order is reversed, like this:


Finally, the “null” characters are removed, and the result is CBA.

Note:  The explanation above is just to help you understand. In reality, no “null” characters are actually used, so you can use mapping strings to reorder any data, even data having binary zeros. The character reversal process just goes from position 5 to position 1 as requested, but when positions 5 and 4 are asked for, it is found that there is no data in those positions and the copying action is simply ignored. So, internally, the command gets treated for this particular string as if you had specified this:

CHANGE R'[a-zA-Z]+' WORD M"3-1"

Created with the Personal Edition of HelpNDoc: Free CHM Help documentation generator