Regular Expressions
Fav| Detection type | regular expression (math.) | Example of detection |
|---|---|---|
| train number | /^[GCDZTSPKXLY1-9]\d{1,4}$/ | G1868、D102、D9、Z5、Z24、Z17 |
| Cell Phone Body Code (IMEI) | /^\d{15,17}$/ | 123456789012345、1234567890123456 |
| URL (or ip) with port number is required | /^((ht|f)tps?:\/\/)?[\w-]+(\.[\w-]+)+:\d{1,5}\/?$/ | 127.0.0.1:5050、baidu.com:8001、https://www.udtool.com:80、http://192.168.1.1:9090 |
| Web address (URL) | /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/ | https://xxx.org/v2/api/#v、www.udtool.com、www.qq.99、//www.udtool.com、ftp://baidu.qq、http://baidu.com、https://www.amap.com/search?id=BV1006、360.com:8080/vue/#/a=1 |
| Unified Social Credit Code (USCC) | /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/ | 91230184MA1BUFLT44、92371000MA3MXH0E3W |
| Unified Social Credit Code (loose match) (15 digits/18 digits/20 digits/letters) | /^(([0-9A-Za-z]{15})|([0-9A-Za-z]{18})|([0-9A-Za-z]{20}))$/ | 91110108772551611J、911101085923662400 |
| thunderbolt link | /^thunderx?:\/\/[a-zA-Z\d]+=$/ | thunder://QUEsICdtYWduZXQ6P3h0PXVybjpidGloOjBCQTE0= |
| ed2k link (loose match) | /^ed2k:\/\/\|file\|.+\|\/$/ | ed2k://|file|%E5%AF%84%E7AB.PARASITE.2019.HD-1080p.X264.AAC-UUMp4(E00.COM).mp4|2501554832|C0BCBED732C20CE577A3|h=5HTKZPQF|/ |
| Magnetic link (loose match) | /^magnet:\?xt=urn:btih:[0-9a-fA-F]{40,}.*$/ | magnet:?xt=urn:btih:40A89A6F4FB1498A98087109D012A9A851FBE0FC |
| Subnet mask (without 0.0.0.0) | /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(255|254|252|248|240|224|192|128|0)$/ | 255.255.255.0、255.255.255.255、255.240.0.0 |
| linux "hidden file" paths | /^\/(?:[^/]+\/)*\.[^/]*/ | /usr/ad/.dd、/root/.gitignore、/.gitignore |
| linux folder path | /^\/(?:[^/]+\/)*$/ | /usr/ad/dd/、/、/root/、/aa/a/aa/ |
| linux file path | /^\/(?:[^/]+\/)*[^/]+$/ | /root/b.ts、/root/abc |
| Window "Folder" Path | /^[a-zA-Z]:\\(?:\w+\\?)*$/ | C:\Users\Adminr\Desktop、e:\m\ |
| Path to "file" under window | /^[a-zA-Z]:\\(?:\w+\\)*\w+\.\w+$/ | C:\Users\Admin\Desktop\qq.link、e:\m\vscode.exe |
| Stock code (A shares) | /^(s[hz]|S[HZ])(000[\d]{3}|002[\d]{3}|300[\d]{3}|600[\d]{3}|60[\d]{4})$/ | sz000858、SZ002136、sz300675、SH600600、sh601155 |
| Greater than or equal to 0, less than or equal to 150, support decimal places appearing 5, such as 145.5, used to determine the score of the examination paper | /^150$|^(?:\d|[1-9]\d|1[0-4]\d)(?:\.5)?$/ | 150、100.5 |
| html comments | /<!--[\s\S]*?-->/g | <!--<div class="_bubble"></div>--><div>chenguzhen87</div><div class="_bubble"></div>--> |
| md5 format (32-bit) | /^[a-fA-F0-9]{32}$/ | 21fe181c5bfc16306a6828c1f7b762e8 |
| GUID/UUID | /^[a-f\d]{4}(?:[a-f\d]{4}-){4}[a-f\d]{12}$/i | e155518c-ca1b-443c-9be9-fe90fdab7345、41E3DAF5-6E37-4BCC-9F8E-0D9521E2AA8D |
| The version number must be in X.Y.Z format. | /^\d+(?:\.\d+){2}$/ | 16.3.10 |
| Video link address (video format can be added or deleted as needed) | /^https?:\/\/(.+\/)+.+(\.(swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4))$/i | http://www.udtool.com/video/wc.avi |
| Image link address (image format can be added or deleted as needed) | /^https?:\/\/(.+\/)+.+(\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i | http://www.udtool.com/logo.png |
| 24-hour time (HH:mm:ss) | /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/ | 23:34:55 |
| 12-hour time (hh:mm:ss) | /^(?:1[0-2]|0?[1-9]):[0-5]\d:[0-5]\d$/ | 11:34:55 |
| base64 format | /^\s*data:(?:[a-z]+\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\-._~:@/?%\s]*?)\s*$/i | data:image/gif;base64,xxxx== |
| Numeric/currency amounts (support for negative numbers, thousands separators) | /^-?\d{1,3}(,\d{3})*(\.\d{1,2})?$/ | 100、-0.99、3、234.32、-1、900、235.09、12,345,678.90 |
| ATM card number | /^[1-9]\d{9,29}$/ | 6234567890、6222026006705354000 |
| Chinese Name | /^(?:[\u4e00-\u9fa5·]{2,16})$/ | Ge, Kevin Durant, and Dirk Werner-Nowitzki. |
| Name in English | /(^[a-zA-Z][a-zA-Z\s]{0,20}[a-zA-Z]$)/ | James、Kevin Wayne Durant、Dirk Nowitzki |
| License plate number (new energy) | /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z](?:((\d{5}[A-HJK])|([A-HJK][A-HJ-NP-Z0-9][0-9]{4}))|[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳])$/ | Beijing AD92035, Gan G23459F, Beijing AA92035 |
| License plate number (non-new energy) | /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]$/ | Beijing A00599, Black D23908 |
| License plate number (new energy + non-new energy) | /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-HJ-NP-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$/ | 京A12345D、京A00599、京AD92035、甘G23459F、京AA92035 |
| 手机号(mobile phone)中国(严谨), 根据工信部2019最新公布的手机号段 | /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[1589]))\d{8}$/ | 008618311006933、+8617888829981、19119255642、19519255642 |
| 手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可 | /^(?:(?:\+|00)86)?1[3-9]\d{9}$/ | 008618311006933、+8617888829981、19119255642 |
| 手机号(mobile phone)中国(最宽松), 只要是1开头即可, 如果你的手机号是用来接收短信, 优先建议选择这一条 | /^(?:(?:\+|00)86)?1\d{10}$/ | 008618311006933、+8617888829981、19119255642 |
| Date (loose) | /^\d{1,4}(-)(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31)$/ | 1990-12-12、1-1-1、0000-1-1 |
| Date (rigorous, supports leap year judgment) | /^(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$/ | 1990-12-12、2000-02-29 |
| Chinese province | /^浙江|上海|北京|天津|重庆|黑龙江|吉林|辽宁|内蒙古|河北|新疆|甘肃|青海|陕西|宁夏|河南|山东|山西|安徽|湖北|湖南|江苏|四川|贵州|云南|广西|西藏|江西|广东|福建|台湾|海南|香港|澳门$/ | Zhejiang, Taiwan |
| The time that can be successfully transformed by momentum YYYYMMDD HH:mm:ss | /^\d{4}([/:-\S])(1[0-2]|0?[1-9])\1(0?[1-9]|[1-2]\d|30|31) (?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/ | 2020/01/01 23:59:59、2020-01-01 00:00:00、20200101 11:11:11 |
| /^(([^<>()[\]\\.,;:\s@"]+(\.[^<> ()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ | 90203918@qq.com, nbilly@126.com, 汉字@qq.com | |
| Tel phone (domestic), e.g. 0341-86091234 | /^(?:(?:\d{3}-)?\d{8}|^(?:\d{4}-)?\d{7,8})(?:-\d+)?$/ | 0936-4211235、89076543、010-12345678-1234 |
| Identity card number (1 generation, 15 digits) | /^[1-9]\d{7}(?:0\d|10|11|12)(?:0[1-9]|[1-2][\d]|30|31)\d{3}$/ | 123456991010193 |
| Identity card number (2 generations, 18 digits), the last digit is a check digit, may be a number or character X | /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/ | 12345619991205131x |
| ID number, support 1/2 generation (15/18 digits) | /^\d{6}((((((19|20)\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|(((19|20)\d{2})(0[13578]|1[02])31)|((19|20)\d{2})02(0[1-9]|1\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\d{3})|((((\d{2})(0[13-9]|1[012])(0[1-9]|[12]\d|30))|((\d{2})(0[13578]|1[02])31)|((\d{2})02(0[1-9]|1\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\d{2}))(\d|X|x)$/ | 622223199912051311、12345619991205131x、123456991010193 |
| Passport (including Hong Kong and Macau) | /(^[EeKkGgDdSsPpHh]\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\d{7}$)/ | s28233515、141234567、159203084、MA1234567、K25345719 |
| Whether the account number is legal (starts with a letter, allows 5-16 bytes, allows alphanumeric underscore combinations) | /^[a-zA-Z]\w{4,15}$/ | justin、justin1989、justin_666 |
| Chinese/Handwriting | /^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/ | Regular, front-end |
| Decimals (scientific notation support) | /^[+-]?(\d+([.]\d*)?([eE][+-]?\d+)?|[.]\d+([eE][+-]?\d+)?)$/ | 0.0、0.09、4E+4 |
| Numbers only | /^\d+$/ | 12345678 |
| html tags (loose match) | /<(\w+)[^>]*>(.*?<\ /\1>)?/ | <div id="app"> 2333 </div>、<input type="text">、<br> |
| Match Chinese characters and Chinese punctuation | /[\u4e00-\u9fa5|\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/ | 匹配中文汉字以及中文标点符号(? ! , 、 ; : “ ” ‘ ' ( ) 《 》 〈 〉 【 】 『 』 「 」 ﹃ ﹄ 〔 〕 … — ~ ﹏ ¥) |
| qq number correctly formatted | /^[1-9][0-9]{4,10}$/ | 903013545、9020304 |
| numerical and alphabetic composition | /^[A-Za-z0-9]+$/ | james666、haha233hi |
| English alphabet | /^[a-zA-Z]+$/ | Russel |
| lowercase letters | /^[a-z]+$/ | russel |
| capital letters | /^[A-Z]+$/ | ABC、KD |
| Password strength checksum, minimum 6 digits, including at least 1 uppercase letter, 1 lowercase letter, 1 number, 1 special character | /^\S*(?=\S{6,})(?=\S*\d)(?=\S*[A-Z])(?=\S*[a-z])(?=\S*[!@#$%^&*? ])\S*$/ | Kd@curry666 |
| User name checksum, 4 to 16 bits (alpha, numeric, underscore, minus sign) | /^[\w-]{4,16}$/ | xiaohua_qq |
| ip-v4[:port] | /^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/ | 172.16.0.0、172.16.0.0:8080、127.0.0.0、127.0.0.0:998 |
| ip-v6[:port] | /(^(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$)|(^\[(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))\](?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$)/i | 2031:0000:130f:0000:0000:09c0:876a:130b |
| hexadecimal color | /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3}|[a-fA-F0-9]{8}|[a-fA-F0-9]{4})$/ | #f00、#fe9de8、#f8f8f8ff、#f003 |
| Microsignal (wx), 6 to 20 digits, starts with a letter, letter, number, minus sign, underscore | /^[a-zA-Z][-_a-zA-Z0-9]{5,19}$/ | github666、kd_-666 |
| Postal code (China) | /^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[0-5]|8[013-6])\d{4}$/ | 734500、100101 |
| Chinese and numbers | /^((?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])|(\d))+$/ | Ha-ha-ha. You're a sixer. |
| Cannot contain letters | /^[^A-Za-z]*$/ | Hello 6, @¥()! |
| java package name | /^([a-zA-Z_]\w*)+([.][a-zA-Z_]\w*)+$/ | com.bbb.name |
| mac address | /^(([a-f0-9][0,2,4,6,8,a,c,e]:([a-f0-9]{2}:){4})|([a-f0-9][0,2,4,6,8,a,c,e]-([a-f0-9]{2}-){4}))[a-f0-9]{2}$/i | 38:f9:d3:4b:f5:51、00-0C-29-CA-E4-66 |
| Match consecutively repeated characters | /(.)\1+/ | Me Me Me Me, 112233, 11234 |
| Numeric and alphabetic composition and containing both numeric and alphabetic characters | /^(?=.*[a-zA-Z])(?=.*\d).+$/ | I a I 1 I, a to 1 |
| Hong Kong Identity Card | /^[a-zA-Z]\d{6}\([\dA]\)$/ | K034169(1) |
| Macau Identity Card | /^[1|5|7]\d{6}\(\d\)$/ | 5686611(1) |
| Taiwan Identity Card | /^[a-zA-Z][0-9]{9}$/ | U193683453 |
| 大写字母,小写字母,数字,特殊符号 `@#$%^&*`~()-+=` 中任意3项密码 | /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z\W_!@#$%^&*`~()-+=]+$)(?![0-9\W_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9\W_!@#$%^&*`~()-+=]/ | a1@、A1@、Aa@ |
| All special characters in the ASCII code list. | /[\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]+/ | [、.、^、&3% |
| Positive integers, not including 0 | /^\+?[1-9]\d*$/ | 1231 |
| Negative integer without 0 | /^-[1-9]\d*$/ | -1231 |
| integer (math.) | /^(?:0|(?:-?[1-9]\d*))$/ | -1231、123、0 |
| floating point | /^(-?[1-9]\d*\.\d+|-?0\.\d*[1-9]\d*|0\.0+)$/ | 1.23、-1.01、0.00 |
| floating point (strict) | /^(-?[1-9]\d*\.\d+|-?0\.\d*[1-9])$/ | 1.23、-1.01 |
| email(support Chinese email) | /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/ | 90203918@qq.com, nbilly@126.com, 啦啦啦@126.com |
| Domain name (not web address, does not contain an agreement) | /^([0-9a-zA-Z-]{1,}\.)+([a-zA-Z]{2,})$/ | www.baidu.com、baidu.com.cn、api.baidu.com、udtool.com |
| Officers/enlisted personnel cards | /^[\u4E00-\u9FA5](字第)([0-9a-zA-Z]{4,8})(号?)$/ | Military No. 1234567, Sergeant No. P123456X |
| household register | /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/ | 441421999707223115 |
1. A regular expression (often abbreviated as Regex or RE) is a pattern used to match combinations of characters within a string.
2. Regular expressions originated in the fields of theory and computer science and are now widely used in various programming languages and text processing tools for searching, replacing, validating, and parsing text.
3. The basic components of a regular expression include:
(1) Character matching: Matches specific characters, such as letters, numbers, or symbols. For example, `a` matches the character ‘a’.
(2) Metacharacters: Characters with special meanings used to represent specific patterns. For example, `.` matches any single character (except newline characters); `*` indicates that the preceding character may appear zero or more times.
(3) Character sets: Denoted by square brackets [], these match any single character within the set. For example, [abc] matches ‘a’, ‘b’, or ‘c’.
(4) Repetition: Specifies the number of times the preceding element can be repeated. For example: a{3} matches ‘aaa’; a{2,4} matches ‘aa’, ‘aaa’, or ‘aaaa’.
(5) Alternation: Denoted by the pipe symbol |, indicating an “or” relationship. For example, a|b matches ‘a’ or ‘b’.
(6) Grouping: Denoted by parentheses (), this allows multiple elements to be combined into a single unit. Example: (ab) treats ‘ab’ as a single unit.
(7) Anchors: Used to specify the position of a match. For example: ^ denotes the beginning of a string; $ denotes the end of a string.
4. Data source for this page: https://github.com/trentlee0/utools-any-rule/blob/master/src/RULES.js
Recommended Tools
AES encryption and decryption tools
AES Online Encryption Tool/AES Online Decryption Tool
Longitude, latitude and degrees, minutes and seconds.
Online conversion tool to convert latitude and longitude in decimal form to degrees, minutes and seconds.
Wood Density Calculator
Calculate the density of wood talent online
Nth power calculator
Online N-square Calculator
Sector Area Calculator
Calculate the area of a sector by angle or radian online
Time Difference Calculator
Calculate the difference between two times
Paint usage calculator
Helps you quickly and accurately calculate the quantity and price of paint you need
Online Circular Area Calculator
Widget to calculate the area of a circle online
Cylinder Side Area Calculator
Calculate the surface area of the side of a cylinder online
calorie converter
Calorie conversion tool online
List of general higher education institutions
A Complete List of National General Colleges and Universities
CSS Hair Glass Effect Generator
Generate code for CSS hair glass effect with one click.
Excel to HTML Forms
convert excel text to html table code
Generator of generic domain names
Pan Domain Bulk Generator tool with support for customizing the set of characters, number of generation and length.
GUID Generation Tool
GUID online generation tool
the Golden Light Divine Mantra
Read The Golden Light Mantra online
Tic Tac Toe Game
Tic-Tac-Toe mini-game against the computer
Online shield badge generation
Generate shield badge in SVG format online
Special Symbols
Some common printable special symbols
Text Hiding Tool
Hide a paragraph of text in another paragraph of text
Online Video Player
Play local videos online, support playback speed adjustment
Video Rotation
Rotate videos online 90 degrees clockwise or 90 degrees counterclockwise and download them locally.
Vitamins and Foods
Highlights vitamins and foods that contain them
Face Text Editor
Online Face Text Editor
























粤ICP备2021116614号