regex only letters without spaces code example Example 1: only letters and spaces regex /^[a-zA-Z\s]*$/g Example 2: regex only letters not spaces var re = /^[A-Za-z]+$/;