# Generating Fractals with Regular Expressions

Generating Fractals with Regular Expressions

This Demonstration shows fractal structures generated by regular expressions. Starting with the array , each integer is replaced by the array formed by prepending to the elements of ,

A=

2 | 1 |

3 | 4 |

n

2×2

n

A

22 | 21 | 12 | 11 |

23 | 24 | 13 | 14 |

32 | 31 | 42 | 41 |

33 | 34 | 43 | 44 |

and the process repeats a number of steps. Then, the elements of the array are evaluated using a regular expression, and colored according to the number of digits that match the selected regular expression.