Replace

From Esolang
Jump to: navigation, search

Replace is an esoteric programming language created by Max Black based around regular expressions. All commands in the language follow the syntax of find/replace. The input to these commands is the program itself meaning that you can dynamically change other commands. When all commands have been evaluated the remainder of the program source is outputted.

Examples

Basic Find/Replace

abc/def
abc

This produces the output:

def/def
def

The interpreter first finds the command abc/def. It then searches for occurrences of abc of which it finds two in the command itself and the line below. Then both occurrences are promptly replaced with def and since the second line is not a command execution halts.

Hello World

Hello World!

If a line is not a find/replace command then it is simply ignored.

External resources