Use RegExp for testing '#' and '.'