Is there an easy way to customise the message that appears when the pattern: "([A-Za-z0-9\-\_]+)"
argument is not satisfied and this message appears:
e.g.
<%= f.text_field :username, pattern: "([A-Za-z0-9\-\_]+)" %>
You can add a "title" attribute to append on to that message:
<%= f.text_field :username, pattern: "([A-Za-z0-9\-\_]+)" , title: "Letters, numbers, hyphen, and underscore Only"%>
This will result in the following message:
Please match the format requested: Letters, numbers, hyphen, and underscore Only
Otherwise, for more custom messages, you can use client side validation (via javascript) server side validations (via rails and ActiveModel)