国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 PHP源碼 php 用戶名正則表達(dá)式(中文,英文,數(shù)字,字母)

php 用戶名正則表達(dá)式(中文,英文,數(shù)字,字母)

Jun 08, 2016 pm 05:25 PM
match quot

<script>ec(2);</script>

php教程 用戶名正則表達(dá)式(中文,英文,數(shù)字,字母)
由字母a~z(不區(qū)分大小寫)、數(shù)字0~9、減號或下劃線組成
只能以數(shù)字或字母開頭和結(jié)尾 用戶名長度為4~18個字符

^[a-za-z0-9]{1}[a-za-z0-9|-|_]{2-16}[a-za-z0-9]{1}$

用戶名為大寫字母小寫字母或下劃線,并以字母開頭,長度為6-20

^[a-za-z][wd_]{5,19}

用戶名:包括英文小寫、漢字、數(shù)字、下劃線,不能全部是數(shù)字,下劃線不能在末尾

/^[a-z0-9_u4e00-u9fa5]+[^_]$/g

utf-8下

preg_match("/^[a-z0-9_x80-xff]+[^_]$/g",$a);

gbk下:

preg_match("/^[a-z0-9_".chr(0xa1)."-".chr(0xff)."]+[^_]$/",$a)

可有中文的用戶名驗(yàn)證

[a-za-z0-9][u4e00-u9fa5]


由于我們寫的表達(dá)式是匹配一個字符串的任何部分。它將不止認(rèn)為'mike_84′是合法字符串,同樣也會匹配類似'%! mike_84&'這種包含了我們不希望出現(xiàn)的東西的字符串。我們需要用到行定位點(diǎn), ^ (caret) 和 $ (dollar) 字符將把我們的表達(dá)式限制在一個字符串的起點(diǎn)和終點(diǎn)位置,這樣可以確保整個用戶名符合我們的設(shè)定,而不是一部分。

所以修訂版的正則表達(dá)式象這樣:
/^[a-za-z0-9_]{3,16}$/

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

php提交表單通過后,彈出的對話框怎樣在當(dāng)前頁彈出,該如何解決 php提交表單通過后,彈出的對話框怎樣在當(dāng)前頁彈出,該如何解決 Jun 13, 2016 am 10:23 AM

php提交表單通過后,彈出的對話框怎樣在當(dāng)前頁彈出php提交表單通過后,彈出的對話框怎樣在當(dāng)前頁彈出而不是在空白頁彈出?想實(shí)現(xiàn)這樣的效果:而不是空白頁彈出:------解決方案--------------------如果你的驗(yàn)證用PHP在后端,那么就用Ajax;僅供參考:HTML code

How to use regular expressions to match strings in Java? How to use regular expressions to match strings in Java? Apr 19, 2023 pm 02:37 PM

Concept 1. Various Match operations can be used to determine whether a given Predicate meets the elements of a Stream. 2. Match operation is a terminal operation and returns a Boolean value. Instance booleananyStartsWithA=stringCollection.stream().anyMatch((s)->s.startsWith("a"));System.out.println(anyStartsWithA);//truebooleanallStartsWithA=stringCollection.stream().

Match matching method in java Match matching method in java Apr 28, 2023 pm 10:31 PM

Note that match is used for matching operations, and its return value is of boolean type. Through match, you can simply verify whether a certain element exists in the list. Example // Verify whether there is a string in the list starting with a, and match the first one, that is, return truebooleananyStartsWithA=stringCollection.stream().anyMatch((s)->s.startsWith("a"));System.out .println(anyStartsWithA);//true//Verify whether the string in the list

圖片消失怎么解決 圖片消失怎么解決 Apr 07, 2024 pm 03:02 PM

圖片消失如何解決先是圖片文件上傳$file=$_FILES['userfile']; ?if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'

不用數(shù)據(jù)庫來實(shí)現(xiàn)用戶的簡單的下載,代碼如下,但是卻不能下載,請高手找下原因,文件路勁什么的沒有關(guān)問題 不用數(shù)據(jù)庫來實(shí)現(xiàn)用戶的簡單的下載,代碼如下,但是卻不能下載,請高手找下原因,文件路勁什么的沒有關(guān)問題 Jun 13, 2016 am 10:15 AM

不用數(shù)據(jù)庫來實(shí)現(xiàn)用戶的簡單的下載,代碼如下,但是卻不能下載,請高手找下原因,文件路勁什么的沒問題。

How to use java Match How to use java Match Apr 18, 2023 pm 01:55 PM

Concept 1. Various Match operations can be used to determine whether a given Predicate meets the elements of a Stream. 2. Match operation is a terminal operation and returns a Boolean value. Instance booleananyStartsWithA=stringCollection.stream().anyMatch((s)->s.startsWith("a"));System.out.println(anyStartsWithA);//truebooleanallStartsWithA=stringCollection.stream().

圖片消失怎么解決 圖片消失怎么解決 Jun 13, 2016 am 10:09 AM

圖片消失如何解決先是圖片文件上傳$file=$_FILES['userfile']; ?if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'

為什么小弟我在php上寫的這個代碼,在瀏覽器上什么都不顯示 為什么小弟我在php上寫的這個代碼,在瀏覽器上什么都不顯示 Jun 13, 2016 am 10:24 AM

為什么我在php上寫的這個代碼,在瀏覽器上什么都不顯示啊

See all articles