Improve handling of literal expressions

Now developers can use the letter '#' directly in literal expressions.
Additionally, replacement using regex improved (I think). Please see the
diff.