Skip to content

Instantly share code, notes, and snippets.

@nocodesupplyco
Created May 8, 2023 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nocodesupplyco/997df11dcb8d825942cd3d60ac1c02a3 to your computer and use it in GitHub Desktop.
Save nocodesupplyco/997df11dcb8d825942cd3d60ac1c02a3 to your computer and use it in GitHub Desktop.
Validate HTML Inputs w/ Pattern Attribute
<!-- Example: validate for specific URL (one that ends in .webflow.io) -->
<input type="url" id="site" name="site" pattern="(https://)+[a-zA-z0-9-/:]+(.webflow.io)+/?" title="Enter a webflow.io URL">
<!-- Example: validate for specific email (one that ends in @example.com) -->
<input type="email" id="email" name="email" pattern="^[A-Za-z0-9._%+-]+@example\.com$" title="Enter a valid email address">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment