Latin charcters included in JavaScript Regex

前端 未结 5 1781
礼貌的吻别
礼貌的吻别 2021-02-08 03:06

I\'m looking to included the Latin characters below in a JavaScript regex for a string validation.

ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏàáâãäåæçèéêëìíîïÐÑÒÓÔÕÖØÙÚÛÜÝÞßðñòóôõöøùúûüýþÿ         


        
5条回答
  •  伪装坚强ぢ
    2021-02-08 03:50

    Below java script function will work fine, you can add number as well.
    
    function myFunction() {
      var str = "xq234"; 
      var allowChars = "^[a-zA-ZÀ-ÿ]+$";
      var res = str.match(allowChars);
      if(!str.match(allowChars)){
        res="true";
      }
      else {
        res="false";
      }
      document.getElementById("demo").innerHTML = res;`enter code here`
    

提交回复
热议问题