![]() | Fun 0.41.5 The programming language that makes You have fun |
VM opcode snippet for OP_REGEX_REPLACE (POSIX global replace). More...
Go to the source code of this file.
Functions | |
| if (str.type !=VAL_STRING||pattern.type !=VAL_STRING||repl.type !=VAL_STRING) | |
| free_value (repl) | |
| free_value (pattern) | |
| free_value (str) | |
| push_value (vm, out) | |
Variables | |
| case | OP_REGEX_REPLACE |
| Value | pattern = pop_value(vm) |
| Value | str = pop_value(vm) |
| Value | out = make_string(str.s ? str.s : "") |
| break | |
VM opcode snippet for OP_REGEX_REPLACE (POSIX global replace).
Performs a global search-and-replace on the input string using a POSIX regular expression pattern and a replacement string. Backreferences in the replacement are not expanded (simple literal replacement).
Behavior (stack effects):
Platform notes:
Errors:
Example:
Definition in file regex_replace.c.
| free_value | ( | pattern | ) |
| free_value | ( | repl | ) |
| free_value | ( | str | ) |
| if | ( | str.type ! | = VAL_STRING || pattern.type != VAL_STRING || repl.type != VAL_STRING | ) |
Definition at line 45 of file regex_replace.c.
| push_value | ( | vm | , |
| out | ) |
| break |
Definition at line 56 of file regex_replace.c.
| case OP_REGEX_REPLACE |
Definition at line 41 of file regex_replace.c.
| Value out = make_string(str.s ? str.s : "") |
Definition at line 51 of file regex_replace.c.
| Value pattern = pop_value(vm) |
Definition at line 43 of file regex_replace.c.
| Value str = pop_value(vm) |
Definition at line 44 of file regex_replace.c.