Help for this page
s/<~( ( [^~]* # match anything but a ~ ... # it is still available for matching )* # match this sequence again )/expand($1)/x;