<address id="ousso"></address>
<form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
  1. php語言

    PHP正則匹配中文字母數字正則的表達式

    時間:2025-04-17 13:16:35 php語言 我要投稿

    PHP正則匹配中文字母數字正則的表達式

      PHP語言是一門實用性很強的語言,下面小編為大家帶來了關于PHP正則匹配中文字母數字正則的表達式,歡迎大家閱讀!

      PHP正則匹配中文字母數字正則的表達式

      代碼如下

      if(preg_match("/^d*$/", "4312"))

      {

      echo "全數字

      ";

      }

      if(preg_match("/^[a-z]*$/i", "fdsFDfd"))

      {

      echo "全字母

      ";

      }

      if(preg_match("/^[a-zd]*$/i", "fd4fd34"))

      {

      echo "有數字有字母

      ";

      }

      中文漢字

      代碼如下

      $username=$_REQUEST['username'];

      if(!preg_match("/^[a-z0-9xa1-xff]{3,10}$/",$username))

      {

      echo"34r345";

      exit;

      }

      上面是比較散的,下面把幾個總結到一起來

      代碼如下

      $input_tag = $_POST['tag'];

      $input_tag = explode(',', $input_tag);

      $input_tag = array_unique($input_tag);

      $input_tag = array_diff($input_tag, array(null));

      $leng = '';

      $true = '';

      $comma = '';

      foreach ($input_tag as $v) {

      if (strlen($v) > 18) {

      $leng .= $comma . $v;

      $comma = ',';

      }

      $true .= $comma . $v;

      $comma = ',';

      }

      $true = str_replace(',', '', $true);

      if (!preg_match('/^[x80-xff_a-zA-Z0-9]+$/', $true)) {

      echo "";

      exit;

      }

      if (!empty($leng)) {

      echo "";

      exit;

      }


    【PHP正則匹配中文字母數字正則的表達式】相關文章:

    PHP正則匹配中文字母數字正則表達式03-17

    PHP常用的正則表達式05-18

    PHP常用正則表達式02-15

    php漢字正則表達式06-03

    PHP知識:PHP常用正則表達式大全03-16

    PHP常用的正則表達式是什么02-26

    php正則表達式的基本語法總結05-28

    php正則去掉php注釋07-30

    用php常用表單驗證的正則表達式02-27

    <address id="ousso"></address>
    <form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
    1. 日日做夜狠狠爱欧美黑人