$reptokcs » History » Version 1
Per Amundsen, 08/10/2015 06:08 AM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | *$reptokcs(text,token,new,N,C)* |
||
| 4 | |||
| 5 | Replaces the Nth matching token in text with a new token. |
||
| 6 | |||
| 7 | _[[$reptokcs]] is case-sensitive, see [[$reptok]] for case-insensitive version._ |
||
| 8 | |||
| 9 | *Parameters* |
||
| 10 | |||
| 11 | text - The text to tokenize. |
||
| 12 | token - Token to match. |
||
| 13 | new - New token to replace with. |
||
| 14 | N - If N = 0, all matching tokens, otherwise the Nth match. |
||
| 15 | C - The "ASCII":http://www.asciitable.com/ value to tokenize by. |
||
| 16 | |||
| 17 | *Example* |
||
| 18 | |||
| 19 | <pre> |
||
| 20 | ; Replace the first token matching 'B' with 'E' |
||
| 21 | //echo -ag $reptokcs(a.B.b.c.d,B,E,1,46) |
||
| 22 | |||
| 23 | ; Replace all tokens matching 'B' with 'e' |
||
| 24 | //echo -ag $reptokcs(B.B.B.b,B,e,0,46) |
||
| 25 | </pre> |