//var %temp | var %null = $regsub($+($chr(3), 1, $chr(3), 2, $chr(3), 3), /(\003)/g, x, %temp) | echo -a %temp
(edit: forgot to show result)
x1x2x3

showing a regsub operation functioning to find and replace \003 (color code)

alias regextest {
bset &test 1 5 4 3 2 1
.fopen -on test test
.fwrite -b test &test
.fseek test 0
bunset &test
while (!$feof) {
fseek -r test (\003)
var %null = $fread(test, 1, &test)
if (!$feof) echo -s position: $calc($fopen(test).pos - 1) value: $bvar(&test, 1)
}
.fclose test
.remove test
}

/regextest

* fseek set 'test' to next line matching regex '(\003)'
-
position: 0 value: 5
-
* fseek set 'test' to next line matching regex '(\003)'
-
position: 1 value: 4
-
* fseek set 'test' to next line matching regex '(\003)'
-
position: 2 value: 3
-
* fseek failed on 'test'

Matches any ascii value that is not below 3?

Last edited by Netchelandorious; 11/03/04 04:57 AM.