The current state of ASH functions:
The only way to use regular expressions in buffer replacements is via replace_all and replace_first. However, since those return strings, not buffers, we currently need to do something along the lines of
I would find it more convenient if ASH permitted something like
Code:
string replace_all( matcher, string )
string replace_first( matcher, string )
buffer replace_string( buffer, string, string )
buffer replace_string( string, string, string )
The only way to use regular expressions in buffer replacements is via replace_all and replace_first. However, since those return strings, not buffers, we currently need to do something along the lines of
Code:
buffer body;
...
matcher m = create_matcher(pattern, body);
string s = match.replace_first(replacement_text);
body.set_length(0);
body.append(s);
I would find it more convenient if ASH permitted something like
Code:
buffer body;
...
matcher m = create_matcher(pattern, body);
body = match.replace_first(replacement_text);