Add regex-dependent before method, and alter layout.erb to show context-dependent message