Seamless Solutions, Tailored Integration info@wkintegrations.com Kendal, Cumbria, UK

Blog

Examples of Regular Expressions

  1. Trim string in JavaScript
    var trimre='^s+|s+$'; // replace whitespace
    var trimmedstring = string.replace(trimre,"");
  2. Check for a valid date format in JavaScript
    var re='^(d{1,2})/(d{1,2})/(d{4})$'; // dd/mm/yyyy
    if (!datestring.match(re))
    {
    alert("Date" + datestring + " not in valid dd/mm/yyyy format");
    }
    else // valid date keyed in
    {
    ...valid date keyed
    }
  3. More to follow...

Need help with an integration?

Get in touch