Skip to content

Instantly share code, notes, and snippets.

@jeromeabel
Created May 10, 2023 21:31
Show Gist options
  • Select an option

  • Save jeromeabel/8b4fb47de4edbc74d0dc6c6d8ce196aa to your computer and use it in GitHub Desktop.

Select an option

Save jeromeabel/8b4fb47de4edbc74d0dc6c6d8ce196aa to your computer and use it in GitHub Desktop.

// Regexp patterns

const regexName = /^[A-ÿ]{2,}[A-ÿ\-\s]*$/;
const regexEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]{2,3})$/; // from mdn + fix
const regexNumber = /^[0-9]+$/; 
const regexDate = /([\d]+)([\-\./])([\d]+)([\-\./])([\d]+)|((Jan(|uary)|Feb(|ruary)|Mar(|ch)|Apr(|il)|May|Jun(|e)|Jul(|y)|Aug(|ust)|Sept(|ember)|Oct(|ober)|(Nov|Dec)(|ember))([\s\-])(|([\d]+){1,2}([\s\-]|\, ))([\d]+){4})/;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment