Pattern based substitution

How does pattern based substitution works ?

For example, how does textilize replace all occurrences of hello world
with hello world ?

Thanks