最全常用正则表达式大全
涓銆佹牎楠屾暟瀛楃殑琛ㄨ揪寮
1. 鏁板瓧锛歗[0-9]*$
2. n浣嶇殑鏁板瓧锛歗\d{n}$
3. 鑷冲皯n浣嶇殑鏁板瓧锛歗\d{n,}$
4. m-n浣嶇殑鏁板瓧锛歗\d{m,n}$
5. 闆跺拰闈為浂寮澶寸殑鏁板瓧锛歗(0|[1-9][0-9]*)$
6. 闈為浂寮澶寸殑鏈澶氬甫涓や綅灏忔暟鐨勬暟瀛楋細^([1-9][0-9]*)+(.[0-9]{1,2})?$
7. 甯1-2浣嶅皬鏁扮殑姝f暟鎴栬礋鏁帮細^(\-)?\d+(\.\d{1,2})?$
8. 姝f暟銆佽礋鏁般佸拰灏忔暟锛歗(\-|\+)?\d+(\.\d+)?$
9. 鏈変袱浣嶅皬鏁扮殑姝e疄鏁帮細^[0-9]+(.[0-9]{2})?$
10. 鏈1~3浣嶅皬鏁扮殑姝e疄鏁帮細^[0-9]+(.[0-9]{1,3})?$
11. 闈為浂鐨勬鏁存暟锛歗[1-9]\d*$ 鎴 ^([1-9][0-9]*){1,3}$ 鎴 ^\+?[1-9][0-9]*$
12. 闈為浂鐨勮礋鏁存暟锛歗\-[1-9][]0-9"*$ 鎴 ^-[1-9]\d*$
13. 闈炶礋鏁存暟锛歗\d+$ 鎴 ^[1-9]\d*|0$
14. 闈炴鏁存暟锛歗-[1-9]\d*|0$ 鎴 ^((-\d+)|(0+))$
15. 闈炶礋娴偣鏁帮細^\d+(\.\d+)?$ 鎴 ^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$
16. 闈炴娴偣鏁帮細^((-\d+(\.\d+)?)|(0+(\.0+)?))$ 鎴 ^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$
17. 姝f诞鐐规暟锛歗[1-9]\d*\.\d*|0\.\d*[1-9]\d*$ 鎴 ^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$
18. 璐熸诞鐐规暟锛歗-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$ 鎴 ^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$
19. 娴偣鏁帮細^(-?\d+)(\.\d+)?$ 鎴 ^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$
浜屻佹牎楠屽瓧绗︾殑琛ㄨ揪寮
1. 姹夊瓧锛歗[\u4e00-\u9fa5]{0,}$
2. 鑻辨枃鍜屾暟瀛楋細^[A-Za-z0-9]+$ 鎴 ^[A-Za-z0-9]{4,40}$
3. 闀垮害涓3-20鐨勬墍鏈夊瓧绗︼細^.{3,20}$
4. 鐢26涓嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓诧細^[A-Za-z]+$
5. 鐢26涓ぇ鍐欒嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓诧細^[A-Z]+$
6. 鐢26涓皬鍐欒嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓诧細^[a-z]+$
7. 鐢辨暟瀛楀拰26涓嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓诧細^[A-Za-z0-9]+$
8. 鐢辨暟瀛椼26涓嫳鏂囧瓧姣嶆垨鑰呬笅鍒掔嚎缁勬垚鐨勫瓧绗︿覆锛歗\w+$ 鎴 ^\w{3,20}$
9. 涓枃銆佽嫳鏂囥佹暟瀛楀寘鎷笅鍒掔嚎锛歗[\u4E00-\u9FA5A-Za-z0-9_]+$
10. 涓枃銆佽嫳鏂囥佹暟瀛椾絾涓嶅寘鎷笅鍒掔嚎绛夌鍙凤細^[\u4E00-\u9FA5A-Za-z0-9]+$ 鎴 ^[\u4E00-\u9FA5A-Za-z0-9]{2,20}$
11. 鍙互杈撳叆鍚湁^%&',;=?$\"绛夊瓧绗︼細[^%&',;=?$\x22]+ 12 绂佹杈撳叆鍚湁~鐨勫瓧绗︼細[^~\x22]+
鍏跺畠锛
.*鍖归厤闄 \n 浠ュ鐨勪换浣曞瓧绗︺
/[\u4E00-\u9FA5]/ 姹夊瓧
/[\uFF00-\uFFFF]/ 鍏ㄨ绗﹀彿
/[\u0000-\u00FF]/ 鍗婅绗﹀彿
涓夈佺壒娈婇渶姹傝〃杈惧紡
1. Email鍦板潃锛歗\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
2. 鍩熷悕锛歔a-zA-Z0-9][-a-zA-Z0-9]{0,62}(/.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+/.?
3. InternetURL锛歔a-zA-z]+://[^\s]* 鎴 ^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$
4. 鎵嬫満鍙风爜锛歗(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
5. 鐢佃瘽鍙风爜("XXX-XXXXXXX"銆"XXXX-XXXXXXXX"銆"XXX-XXXXXXX"銆"XXX-XXXXXXXX"銆"XXXXXXX"鍜"XXXXXXXX)锛歗(\(\d{3,4}-)|\d{3.4}-)?\d{7,8}$
6. 鍥藉唴鐢佃瘽鍙风爜(0511-4405222銆021-87888822)锛歕d{3}-\d{8}|\d{4}-\d{7}
7. 韬唤璇佸彿(15浣嶃18浣嶆暟瀛)锛歗\d{15}|\d{18}$
8. 鐭韩浠借瘉鍙风爜(鏁板瓧銆佸瓧姣峹缁撳熬)锛歗([0-9]){7,18}(x|X)?$ 鎴 ^\d{8,18}|[0-9x]{8,18}|[0-9X]{8,18}?$
9. 甯愬彿鏄惁鍚堟硶(瀛楁瘝寮澶达紝鍏佽5-16瀛楄妭锛屽厑璁稿瓧姣嶆暟瀛椾笅鍒掔嚎)锛歗[a-zA-Z][a-zA-Z0-9_]{4,15}$
10. 瀵嗙爜(浠ュ瓧姣嶅紑澶达紝闀垮害鍦6~18涔嬮棿锛屽彧鑳藉寘鍚瓧姣嶃佹暟瀛楀拰涓嬪垝绾)锛歗[a-zA-Z]\w{5,17}$
11. 寮哄瘑鐮(蹇呴』鍖呭惈澶у皬鍐欏瓧姣嶅拰鏁板瓧鐨勭粍鍚堬紝涓嶈兘浣跨敤鐗规畩瀛楃锛岄暱搴﹀湪8-10涔嬮棿)锛歗(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$
12. 鏃ユ湡鏍煎紡锛歗\d{4}-\d{1,2}-\d{1,2}
13. 涓骞寸殑12涓湀(01锝09鍜1锝12)锛歗(0?[1-9]|1[0-2])$
14. 涓涓湀鐨31澶(01锝09鍜1锝31)锛歗((0?[1-9])|((1|2)[0-9])|30|31)$
15. 閽辩殑杈撳叆鏍煎紡锛
16. 1.鏈夊洓绉嶉挶鐨勮〃绀哄舰寮忔垜浠彲浠ユ帴鍙:"10000.00" 鍜 "10,000.00", 鍜屾病鏈 "鍒" 鐨 "10000" 鍜 "10,000"锛歗[1-9][0-9]*$
17. 2.杩欒〃绀轰换鎰忎竴涓笉浠0寮澶寸殑鏁板瓧,浣嗘槸,杩欎篃鎰忓懗鐫涓涓瓧绗"0"涓嶉氳繃,鎵浠ユ垜浠噰鐢ㄤ笅闈㈢殑褰㈠紡锛歗(0|[1-9][0-9]*)$
18. 3.涓涓0鎴栬呬竴涓笉浠0寮澶寸殑鏁板瓧.鎴戜滑杩樺彲浠ュ厑璁稿紑澶存湁涓涓礋鍙凤細^(0|-?[1-9][0-9]*)$
19. 4.杩欒〃绀轰竴涓0鎴栬呬竴涓彲鑳戒负璐熺殑寮澶翠笉涓0鐨勬暟瀛.璁╃敤鎴蜂互0寮澶村ソ浜.鎶婅礋鍙风殑涔熷幓鎺,鍥犱负閽辨讳笉鑳芥槸璐熺殑鍚.涓嬮潰鎴戜滑瑕佸姞鐨勬槸璇存槑鍙兘鐨勫皬鏁伴儴鍒嗭細^[0-9]+(.[0-9]+)?$
20. 5.蹇呴』璇存槑鐨勬槸,灏忔暟鐐瑰悗闈㈣嚦灏戝簲璇ユ湁1浣嶆暟,鎵浠"10."鏄笉閫氳繃鐨,浣嗘槸 "10" 鍜 "10.2" 鏄氳繃鐨勶細^[0-9]+(.[0-9]{2})?$
21. 6.杩欐牱鎴戜滑瑙勫畾灏忔暟鐐瑰悗闈㈠繀椤绘湁涓や綅,濡傛灉浣犺涓哄お鑻涘埢浜,鍙互杩欐牱锛歗[0-9]+(.[0-9]{1,2})?$
22. 7.杩欐牱灏卞厑璁哥敤鎴峰彧鍐欎竴浣嶅皬鏁.涓嬮潰鎴戜滑璇ヨ冭檻鏁板瓧涓殑閫楀彿浜,鎴戜滑鍙互杩欐牱锛歗[0-9]{1,3}(,[0-9]{3})*(.[0-9]{1,2})?$
23 8.1鍒3涓暟瀛,鍚庨潰璺熺潃浠绘剰涓 閫楀彿+3涓暟瀛,閫楀彿鎴愪负鍙,鑰屼笉鏄繀椤伙細^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(.[0-9]{1,2})?$
24. 澶囨敞锛氳繖灏辨槸鏈缁堢粨鏋滀簡,鍒繕浜"+"鍙互鐢"*"鏇夸唬濡傛灉浣犺寰楃┖瀛楃涓蹭篃鍙互鎺ュ彈鐨勮瘽(濂囨,涓轰粈涔?)鏈鍚,鍒繕浜嗗湪鐢ㄥ嚱鏁版椂鍘绘帀鍘绘帀閭d釜鍙嶆枩鏉,涓鑸殑閿欒閮藉湪杩欓噷
25. xml鏂囦欢锛歗([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$
26. 涓枃瀛楃鐨勬鍒欒〃杈惧紡锛歔\u4e00-\u9fa5]
27. 鍙屽瓧鑺傚瓧绗︼細[^\x00-\xff] (鍖呮嫭姹夊瓧鍦ㄥ唴锛屽彲浠ョ敤鏉ヨ绠楀瓧绗︿覆鐨勯暱搴(涓涓弻瀛楄妭瀛楃闀垮害璁2锛孉SCII瀛楃璁1))
28. 绌虹櫧琛岀殑姝e垯琛ㄨ揪寮忥細\n\s*\r (鍙互鐢ㄦ潵鍒犻櫎绌虹櫧琛)
29. HTML鏍囪鐨勬鍒欒〃杈惧紡锛<(\S*?)[^>]*>.*?</\1>|<.*? /> (缃戜笂娴佷紶鐨勭増鏈お绯熺硶锛屼笂闈㈣繖涓篃浠呬粎鑳介儴鍒嗭紝瀵逛簬澶嶆潅鐨勫祵濂楁爣璁颁緷鏃ф棤鑳戒负鍔)
30. 棣栧熬绌虹櫧瀛楃鐨勬鍒欒〃杈惧紡锛歗\s*|\s*$鎴(^\s*)|(\s*$) (鍙互鐢ㄦ潵鍒犻櫎琛岄琛屽熬鐨勭┖鐧藉瓧绗(鍖呮嫭绌烘牸銆佸埗琛ㄧ銆佹崲椤电绛夌瓑)锛岄潪甯告湁鐢ㄧ殑琛ㄨ揪寮)
31. 鑵捐QQ鍙凤細[1-9][0-9]{4,} (鑵捐QQ鍙蜂粠10000寮濮)
32. 涓浗閭斂缂栫爜锛歔1-9]\d{5}(?!\d) (涓浗閭斂缂栫爜涓6浣嶆暟瀛)
33. IP鍦板潃锛歕d+\.\d+\.\d+\.\d+ (鎻愬彇IP鍦板潃鏃舵湁鐢)
34. IP鍦板潃锛((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))
35. IP-v4鍦板潃锛歕\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b (鎻愬彇IP鍦板潃鏃舵湁鐢)
36. 鏍¢獙IP-v6鍦板潃:(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))
37. 瀛愮綉鎺╃爜锛((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))
38. 鏍¢獙鏃ユ湡:^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$(鈥測yyy-mm-dd鈥 鏍煎紡鐨勬棩鏈熸牎楠岋紝宸茶冭檻骞抽棸骞淬)
39. 鎶藉彇娉ㄩ噴锛<!--(.*?)-->
40. 鏌ユ壘CSS灞炴:^\\s*[a-zA-Z\\-]+\\s*[:]{1}\\s[a-zA-Z0-9\\s.#]+[;]{1}
41. 鎻愬彇椤甸潰瓒呴摼鎺:(<a\\s*(?!.*\\brel=)[^>]*)(href="https?:\\/\\/)((?!(?:(?:www\\.)?'.implode('|(?:www\\.)?', $follow_list).'))[^" rel="external nofollow" ]+)"((?!.*\\brel=)[^>]*)(?:[^>]*)>
42. 鎻愬彇缃戦〉鍥剧墖:\\< *[img][^\\\\>]*[src] *= *[\\"\\']{0,1}([^\\"\\'\\ >]*)
43. 鎻愬彇缃戦〉棰滆壊浠g爜:^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
44. 鏂囦欢鎵╁睍鍚嶆晥楠:^([a-zA-Z]\\:|\\\\)\\\\([^\\\\]+\\\\)*[^\\/:*?"<>|]+\\.txt(l)?$
45. 鍒ゆ柇IE鐗堟湰锛歗.*MSIE [5-8](?:\\.[0-9]+)?(?!.*Trident\\/[5-9]\\.0).*$
鍏冨瓧绗
鎻忚堪
\
灏嗕笅涓涓瓧绗︽爣璁扮銆佹垨涓涓悜鍚庡紩鐢ㄣ佹垨涓涓叓杩涘埗杞箟绗︺備緥濡傦紝鈥淺\n鈥濆尮閰峔n銆傗淺n鈥濆尮閰嶆崲琛岀銆傚簭鍒椻淺\鈥濆尮閰嶁淺鈥濊屸淺(鈥濆垯鍖归厤鈥(鈥濄傚嵆鐩稿綋浜庡绉嶇紪绋嬭瑷涓兘鏈夌殑鈥滆浆涔夊瓧绗︹濈殑姒傚康銆
^
鍖归厤杈撳叆瀛楄棣栥傚鏋滆缃簡RegExp瀵硅薄鐨凪ultiline灞炴э紝^涔熷尮閰嶁淺n鈥濇垨鈥淺r鈥濅箣鍚庣殑浣嶇疆銆
$
鍖归厤杈撳叆琛屽熬銆傚鏋滆缃簡RegExp瀵硅薄鐨凪ultiline灞炴э紝$涔熷尮閰嶁淺n鈥濇垨鈥淺r鈥濅箣鍓嶇殑浣嶇疆銆
*
鍖归厤鍓嶉潰鐨勫瓙琛ㄨ揪寮忎换鎰忔銆備緥濡傦紝zo*鑳藉尮閰嶁渮鈥濓紝涔熻兘鍖归厤鈥渮o鈥濅互鍙娾渮oo鈥濄*绛変环浜巤0,}銆
+
鍖归厤鍓嶉潰鐨勫瓙琛ㄨ揪寮忎竴娆℃垨澶氭(澶т簬绛変簬1娆★級銆備緥濡傦紝鈥渮o+鈥濊兘鍖归厤鈥渮o鈥濅互鍙娾渮oo鈥濓紝浣嗕笉鑳藉尮閰嶁渮鈥濄+绛変环浜巤1,}銆
?
鍖归厤鍓嶉潰鐨勫瓙琛ㄨ揪寮忛浂娆℃垨涓娆°備緥濡傦紝鈥渄o(es)?鈥濆彲浠ュ尮閰嶁渄o鈥濇垨鈥渄oes鈥濄?绛変环浜巤0,1}銆
{n}
n鏄竴涓潪璐熸暣鏁般傚尮閰嶇‘瀹氱殑n娆°備緥濡傦紝鈥渙{2}鈥濅笉鑳藉尮閰嶁淏ob鈥濅腑鐨勨渙鈥濓紝浣嗘槸鑳藉尮閰嶁渇ood鈥濅腑鐨勪袱涓猳銆
{n,}
n鏄竴涓潪璐熸暣鏁般傝嚦灏戝尮閰峮娆°備緥濡傦紝鈥渙{2,}鈥濅笉鑳藉尮閰嶁淏ob鈥濅腑鐨勨渙鈥濓紝浣嗚兘鍖归厤鈥渇oooood鈥濅腑鐨勬墍鏈塷銆傗渙{1,}鈥濈瓑浠蜂簬鈥渙+鈥濄傗渙{0,}鈥濆垯绛変环浜庘渙*鈥濄
{n,m}
m鍜宯鍧囦负闈炶礋鏁存暟锛屽叾涓璶<=m銆傛渶灏戝尮閰峮娆′笖鏈澶氬尮閰峬娆°備緥濡傦紝鈥渙{1,3}鈥濆皢鍖归厤鈥渇ooooood鈥濅腑鐨勫墠涓変釜o涓轰竴缁勶紝鍚庝笁涓猳涓轰竴缁勩傗渙{0,1}鈥濈瓑浠蜂簬鈥渙?鈥濄傝娉ㄦ剰鍦ㄩ楀彿鍜屼袱涓暟涔嬮棿涓嶈兘鏈夌┖鏍笺
?
褰撹瀛楃绱ц窡鍦ㄤ换浣曚竴涓叾浠栭檺鍒剁锛*,+,?锛寋n}锛寋n,}锛寋n,m}锛夊悗闈㈡椂锛屽尮閰嶆ā寮忔槸闈炶椽濠殑銆傞潪璐┆妯″紡灏藉彲鑳藉皯鍦板尮閰嶆墍鎼滅储鐨勫瓧绗︿覆锛岃岄粯璁ょ殑璐┆妯″紡鍒欏敖鍙兘澶氬湴鍖归厤鎵鎼滅储鐨勫瓧绗︿覆銆備緥濡傦紝瀵逛簬瀛楃涓测渙ooo鈥濓紝鈥渙+鈥濆皢灏藉彲鑳藉鍦板尮閰嶁渙鈥濓紝寰楀埌缁撴灉[鈥渙ooo鈥漖锛岃屸渙+?鈥濆皢灏藉彲鑳藉皯鍦板尮閰嶁渙鈥濓紝寰楀埌缁撴灉 ['o', 'o', 'o', 'o']
.鐐
鍖归厤闄も淺n鈥濆拰"\r"涔嬪鐨勪换浣曞崟涓瓧绗︺傝鍖归厤鍖呮嫭鈥淺n鈥濆拰"\r"鍦ㄥ唴鐨勪换浣曞瓧绗︼紝璇蜂娇鐢ㄥ儚鈥淸\s\S]鈥濈殑妯″紡銆
(pattern)
鍖归厤pattern骞惰幏鍙栬繖涓鍖归厤銆傛墍鑾峰彇鐨勫尮閰嶅彲浠ヤ粠浜х敓鐨凪atches闆嗗悎寰楀埌锛屽湪VBScript涓娇鐢⊿ubMatches闆嗗悎锛屽湪JScript涓垯浣跨敤$0鈥$9灞炴с傝鍖归厤鍦嗘嫭鍙峰瓧绗︼紝璇蜂娇鐢ㄢ溾濇垨鈥溾濄
(?:pattern)
闈炶幏鍙栧尮閰嶏紝鍖归厤pattern浣嗕笉鑾峰彇鍖归厤缁撴灉锛屼笉杩涜瀛樺偍渚涗互鍚庝娇鐢ㄣ傝繖鍦ㄤ娇鐢ㄦ垨瀛楃鈥(|)鈥濇潵缁勫悎涓涓ā寮忕殑鍚勪釜閮ㄥ垎鏃跺緢鏈夌敤銆備緥濡傗渋ndustr(?:y|ies)鈥濆氨鏄竴涓瘮鈥渋ndustry|industries鈥濇洿绠鐣ョ殑琛ㄨ揪寮忋
(?=pattern)
闈炶幏鍙栧尮閰嶏紝姝e悜鑲畾棰勬煡锛屽湪浠讳綍鍖归厤pattern鐨勫瓧绗︿覆寮濮嬪鍖归厤鏌ユ壘瀛楃涓诧紝璇ュ尮閰嶄笉闇瑕佽幏鍙栦緵浠ュ悗浣跨敤銆備緥濡傦紝鈥淲indows(?=95|98|NT|2000)鈥濊兘鍖归厤鈥淲indows2000鈥濅腑鐨勨淲indows鈥濓紝浣嗕笉鑳藉尮閰嶁淲indows3.1鈥濅腑鐨勨淲indows鈥濄傞鏌ヤ笉娑堣楀瓧绗︼紝涔熷氨鏄锛屽湪涓涓尮閰嶅彂鐢熷悗锛屽湪鏈鍚庝竴娆″尮閰嶄箣鍚庣珛鍗冲紑濮嬩笅涓娆″尮閰嶇殑鎼滅储锛岃屼笉鏄粠鍖呭惈棰勬煡鐨勫瓧绗︿箣鍚庡紑濮嬨
(?!pattern)
闈炶幏鍙栧尮閰嶏紝姝e悜鍚﹀畾棰勬煡锛屽湪浠讳綍涓嶅尮閰峱attern鐨勫瓧绗︿覆寮濮嬪鍖归厤鏌ユ壘瀛楃涓诧紝璇ュ尮閰嶄笉闇瑕佽幏鍙栦緵浠ュ悗浣跨敤銆備緥濡傗淲indows(?!95|98|NT|2000)鈥濊兘鍖归厤鈥淲indows3.1鈥濅腑鐨勨淲indows鈥濓紝浣嗕笉鑳藉尮閰嶁淲indows2000鈥濅腑鐨勨淲indows鈥濄
(?<=pattern)
闈炶幏鍙栧尮閰嶏紝鍙嶅悜鑲畾棰勬煡锛屼笌姝e悜鑲畾棰勬煡绫讳技锛屽彧鏄柟鍚戠浉鍙嶃備緥濡傦紝鈥(?<=95|98|NT|2000)Windows鈥濊兘鍖归厤鈥2000Windows鈥濅腑鐨勨淲indows鈥濓紝浣嗕笉鑳藉尮閰嶁3.1Windows鈥濅腑鐨勨淲indows鈥濄
*python鐨勬鍒欒〃杈惧紡娌℃湁瀹屽叏鎸夌収姝e垯琛ㄨ揪寮忚鑼冨疄鐜帮紝鎵浠ヤ竴浜涢珮绾х壒鎬у缓璁娇鐢ㄥ叾浠栬瑷濡俲ava銆乻cala绛
(?<!patte_n)
闈炶幏鍙栧尮閰嶏紝鍙嶅悜鍚﹀畾棰勬煡锛屼笌姝e悜鍚﹀畾棰勬煡绫讳技锛屽彧鏄柟鍚戠浉鍙嶃備緥濡傗(?<!95|98|NT|2000)Windows鈥濊兘鍖归厤鈥3.1Windows鈥濅腑鐨勨淲indows鈥濓紝浣嗕笉鑳藉尮閰嶁2000Windows鈥濅腑鐨勨淲indows鈥濄
*python鐨勬鍒欒〃杈惧紡娌℃湁瀹屽叏鎸夌収姝e垯琛ㄨ揪寮忚鑼冨疄鐜帮紝鎵浠ヤ竴浜涢珮绾х壒鎬у缓璁娇鐢ㄥ叾浠栬瑷濡俲ava銆乻cala绛
x|y
鍖归厤x鎴杫銆備緥濡傦紝鈥渮|food鈥濊兘鍖归厤鈥渮鈥濇垨鈥渇ood鈥(姝ゅ璇疯皑鎱)銆傗淸z|f]ood鈥濆垯鍖归厤鈥渮ood鈥濇垨鈥渇ood鈥濄
[xyz]
瀛楃闆嗗悎銆傚尮閰嶆墍鍖呭惈鐨勪换鎰忎竴涓瓧绗︺備緥濡傦紝鈥淸abc]鈥濆彲浠ュ尮閰嶁減lain鈥濅腑鐨勨渁鈥濄
[^xyz]
璐熷煎瓧绗﹂泦鍚堛傚尮閰嶆湭鍖呭惈鐨勪换鎰忓瓧绗︺備緥濡傦紝鈥淸^abc]鈥濆彲浠ュ尮閰嶁減lain鈥濅腑鐨勨減lin鈥濅换涓瀛楃銆
[a-z]
瀛楃鑼冨洿銆傚尮閰嶆寚瀹氳寖鍥村唴鐨勪换鎰忓瓧绗︺備緥濡傦紝鈥淸a-z]鈥濆彲浠ュ尮閰嶁渁鈥濆埌鈥渮鈥濊寖鍥村唴鐨勪换鎰忓皬鍐欏瓧姣嶅瓧绗︺
娉ㄦ剰:鍙湁杩炲瓧绗﹀湪瀛楃缁勫唴閮ㄦ椂,骞朵笖鍑虹幇鍦ㄤ袱涓瓧绗︿箣闂存椂,鎵嶈兘琛ㄧず瀛楃鐨勮寖鍥; 濡傛灉鍑哄瓧绗︾粍鐨勫紑澶,鍒欏彧鑳借〃绀鸿繛瀛楃鏈韩.
[^a-z]
璐熷煎瓧绗﹁寖鍥淬傚尮閰嶄换浣曚笉鍦ㄦ寚瀹氳寖鍥村唴鐨勪换鎰忓瓧绗︺備緥濡傦紝鈥淸^a-z]鈥濆彲浠ュ尮閰嶄换浣曚笉鍦ㄢ渁鈥濆埌鈥渮鈥濊寖鍥村唴鐨勪换鎰忓瓧绗︺
\b
鍖归厤涓涓崟璇嶇殑杈圭晫锛屼篃灏辨槸鎸囧崟璇嶅拰绌烘牸闂寸殑浣嶇疆锛堝嵆姝e垯琛ㄨ揪寮忕殑鈥滃尮閰嶁濇湁涓ょ姒傚康锛屼竴绉嶆槸鍖归厤瀛楃锛屼竴绉嶆槸鍖归厤浣嶇疆锛岃繖閲岀殑\b灏辨槸鍖归厤浣嶇疆鐨勶級銆備緥濡傦紝鈥渆r\b鈥濆彲浠ュ尮閰嶁渘ever鈥濅腑鐨勨渆r鈥濓紝浣嗕笉鑳藉尮閰嶁渧erb鈥濅腑鐨勨渆r鈥濓紱鈥淺b1_鈥濆彲浠ュ尮閰嶁1_23鈥濅腑鐨勨1_鈥濓紝浣嗕笉鑳藉尮閰嶁21_3鈥濅腑鐨勨1_鈥濄
\B
鍖归厤闈炲崟璇嶈竟鐣屻傗渆r\B鈥濊兘鍖归厤鈥渧erb鈥濅腑鐨勨渆r鈥濓紝浣嗕笉鑳藉尮閰嶁渘ever鈥濅腑鐨勨渆r鈥濄
\cx
鍖归厤鐢眡鎸囨槑鐨勬帶鍒跺瓧绗︺備緥濡傦紝\cM鍖归厤涓涓狢ontrol-M鎴栧洖杞︾銆倄鐨勫煎繀椤讳负A-Z鎴朼-z涔嬩竴銆傚惁鍒欙紝灏哻瑙嗕负涓涓師涔夌殑鈥渃鈥濆瓧绗︺
\d
鍖归厤涓涓暟瀛楀瓧绗︺傜瓑浠蜂簬[0-9]銆俫rep 瑕佸姞涓-P锛宲erl姝e垯鏀寔
\D
鍖归厤涓涓潪鏁板瓧瀛楃銆傜瓑浠蜂簬[^0-9]銆俫rep瑕佸姞涓-P锛宲erl姝e垯鏀寔
\f
鍖归厤涓涓崲椤电銆傜瓑浠蜂簬\x0c鍜孿cL銆
\n
鍖归厤涓涓崲琛岀銆傜瓑浠蜂簬\x0a鍜孿cJ銆
\r
鍖归厤涓涓洖杞︾銆傜瓑浠蜂簬\x0d鍜孿cM銆
\s
鍖归厤浠讳綍涓嶅彲瑙佸瓧绗︼紝鍖呮嫭绌烘牸銆佸埗琛ㄧ銆佹崲椤电绛夌瓑銆傜瓑浠蜂簬[ \f\n\r\t\v]銆
\S
鍖归厤浠讳綍鍙瀛楃銆傜瓑浠蜂簬[^ \f\n\r\t\v]銆
\t
鍖归厤涓涓埗琛ㄧ銆傜瓑浠蜂簬\x09鍜孿cI銆
\v
鍖归厤涓涓瀭鐩村埗琛ㄧ銆傜瓑浠蜂簬\x0b鍜孿cK銆
\w
鍖归厤鍖呮嫭涓嬪垝绾跨殑浠讳綍鍗曡瘝瀛楃銆傜被浼间絾涓嶇瓑浠蜂簬鈥淸A-Za-z0-9_]鈥濓紝杩欓噷鐨"鍗曡瘝"瀛楃浣跨敤Unicode瀛楃闆嗐
\W
鍖归厤浠讳綍闈炲崟璇嶅瓧绗︺傜瓑浠蜂簬鈥淸^A-Za-z0-9_]鈥濄
\xn
鍖归厤n锛屽叾涓璶涓哄崄鍏繘鍒惰浆涔夊笺傚崄鍏繘鍒惰浆涔夊煎繀椤讳负纭畾鐨勪袱涓暟瀛楅暱銆備緥濡傦紝鈥淺x41鈥濆尮閰嶁淎鈥濄傗淺x041鈥濆垯绛変环浜庘淺x04&1鈥濄傛鍒欒〃杈惧紡涓彲浠ヤ娇鐢ˋSCII缂栫爜銆
\num
鍖归厤num锛屽叾涓璶um鏄竴涓鏁存暟銆傚鎵鑾峰彇鐨勫尮閰嶇殑寮曠敤銆備緥濡傦紝鈥(.)\1鈥濆尮閰嶄袱涓繛缁殑鐩稿悓瀛楃銆
\n
鏍囪瘑涓涓叓杩涘埗杞箟鍊兼垨涓涓悜鍚庡紩鐢ㄣ傚鏋淺n涔嬪墠鑷冲皯n涓幏鍙栫殑瀛愯〃杈惧紡锛屽垯n涓哄悜鍚庡紩鐢ㄣ傚惁鍒欙紝濡傛灉n涓哄叓杩涘埗鏁板瓧锛0-7锛夛紝鍒檔涓轰竴涓叓杩涘埗杞箟鍊笺
\nm
鏍囪瘑涓涓叓杩涘埗杞箟鍊兼垨涓涓悜鍚庡紩鐢ㄣ傚鏋淺nm涔嬪墠鑷冲皯鏈塶m涓幏寰楀瓙琛ㄨ揪寮忥紝鍒檔m涓哄悜鍚庡紩鐢ㄣ傚鏋淺nm涔嬪墠鑷冲皯鏈塶涓幏鍙栵紝鍒檔涓轰竴涓悗璺熸枃瀛梞鐨勫悜鍚庡紩鐢ㄣ傚鏋滃墠闈㈢殑鏉′欢閮戒笉婊¤冻锛岃嫢n鍜宮鍧囦负鍏繘鍒舵暟瀛楋紙0-7锛夛紝鍒橽nm灏嗗尮閰嶅叓杩涘埗杞箟鍊糿m銆
\nml
濡傛灉n涓哄叓杩涘埗鏁板瓧锛0-7锛夛紝涓攎鍜宭鍧囦负鍏繘鍒舵暟瀛楋紙0-7锛夛紝鍒欏尮閰嶅叓杩涘埗杞箟鍊糿ml銆
\un
鍖归厤n锛屽叾涓璶鏄竴涓敤鍥涗釜鍗佸叚杩涘埗鏁板瓧琛ㄧず鐨刄nicode瀛楃銆備緥濡傦紝\u00A9鍖归厤鐗堟潈绗﹀彿锛埪╋級銆
\p{P}
灏忓啓 p 鏄 property 鐨勬剰鎬濓紝琛ㄧず Unicode 灞炴э紝鐢ㄤ簬 Unicode 姝h〃杈惧紡鐨勫墠缂銆備腑鎷彿鍐呯殑鈥淧鈥濊〃绀篣nicode 瀛楃闆嗕竷涓瓧绗﹀睘鎬т箣涓锛氭爣鐐瑰瓧绗︺
鍏朵粬鍏釜灞炴э細
L锛氬瓧姣嶏紱
M锛氭爣璁扮鍙凤紙涓鑸笉浼氬崟鐙嚭鐜帮級锛
Z锛氬垎闅旂锛堟瘮濡傜┖鏍笺佹崲琛岀瓑锛夛紱
S锛氱鍙凤紙姣斿鏁板绗﹀彿銆佽揣甯佺鍙风瓑锛夛紱
N锛氭暟瀛楋紙姣斿闃挎媺浼暟瀛椼佺綏椹暟瀛楃瓑锛夛紱
C锛氬叾浠栧瓧绗︺
*娉細姝よ娉曢儴鍒嗚瑷涓嶆敮鎸侊紝渚嬶細javascript銆
\<
\>
鍖归厤璇嶏紙word锛夌殑寮濮嬶紙\<锛夊拰缁撴潫锛圽>锛夈備緥濡傛鍒欒〃杈惧紡\<the\>鑳藉鍖归厤瀛楃涓"for the wise"涓殑"the"锛屼絾鏄笉鑳藉尮閰嶅瓧绗︿覆"otherwise"涓殑"the"銆傛敞鎰忥細杩欎釜鍏冨瓧绗︿笉鏄墍鏈夌殑杞欢閮芥敮鎸佺殑銆
( ) 灏( 鍜 ) 涔嬮棿鐨勮〃杈惧紡瀹氫箟涓衡滅粍鈥濓紙group锛夛紝骞朵笖灏嗗尮閰嶈繖涓〃杈惧紡鐨勫瓧绗︿繚瀛樺埌涓涓复鏃跺尯鍩燂紙涓涓鍒欒〃杈惧紡涓渶澶氬彲浠ヤ繚瀛9涓級锛屽畠浠彲浠ョ敤 \1 鍒癨9 鐨勭鍙锋潵寮曠敤銆
| 灏嗕袱涓尮閰嶆潯浠惰繘琛岄昏緫鈥滄垨鈥濓紙or锛夎繍绠椼備緥濡傛鍒欒〃杈惧紡(him|her) 鍖归厤"it belongs to him"鍜"it belongs to her"锛屼絾鏄笉鑳藉尮閰"it belongs to them."銆傛敞鎰忥細杩欎釜鍏冨瓧绗︿笉鏄墍鏈夌殑杞欢閮芥敮鎸佺殑銆
PS:
https:///regexp/regexp-tutorial.html
鍦ㄧ嚎姝e垯琛ㄨ揪寮忔祴璇: http://tool.oschina.net/regex/
1. 鏁板瓧锛歗[0-9]*$
2. n浣嶇殑鏁板瓧锛歗\d{n}$
3. 鑷冲皯n浣嶇殑鏁板瓧锛歗\d{n,}$
4. m-n浣嶇殑鏁板瓧锛歗\d{m,n}$
5. 闆跺拰闈為浂寮澶寸殑鏁板瓧锛歗(0|[1-9][0-9]*)$
6. 闈為浂寮澶寸殑鏈澶氬甫涓や綅灏忔暟鐨勬暟瀛楋細^([1-9][0-9]*)+(.[0-9]{1,2})?$
7. 甯1-2浣嶅皬鏁扮殑姝f暟鎴栬礋鏁帮細^(\-)?\d+(\.\d{1,2})?$
8. 姝f暟銆佽礋鏁般佸拰灏忔暟锛歗(\-|\+)?\d+(\.\d+)?$
9. 鏈変袱浣嶅皬鏁扮殑姝e疄鏁帮細^[0-9]+(.[0-9]{2})?$
10. 鏈1~3浣嶅皬鏁扮殑姝e疄鏁帮細^[0-9]+(.[0-9]{1,3})?$
11. 闈為浂鐨勬鏁存暟锛歗[1-9]\d*$ 鎴 ^([1-9][0-9]*){1,3}$ 鎴 ^\+?[1-9][0-9]*$
12. 闈為浂鐨勮礋鏁存暟锛歗\-[1-9][]0-9"*$ 鎴 ^-[1-9]\d*$
13. 闈炶礋鏁存暟锛歗\d+$ 鎴 ^[1-9]\d*|0$
14. 闈炴鏁存暟锛歗-[1-9]\d*|0$ 鎴 ^((-\d+)|(0+))$
15. 闈炶礋娴偣鏁帮細^\d+(\.\d+)?$ 鎴 ^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$
16. 闈炴娴偣鏁帮細^((-\d+(\.\d+)?)|(0+(\.0+)?))$ 鎴 ^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$
17. 姝f诞鐐规暟锛歗[1-9]\d*\.\d*|0\.\d*[1-9]\d*$ 鎴 ^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$
18. 璐熸诞鐐规暟锛歗-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$ 鎴 ^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$
19. 娴偣鏁帮細^(-?\d+)(\.\d+)?$ 鎴 ^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$
浜屻佹牎楠屽瓧绗︾殑琛ㄨ揪寮
1. 姹夊瓧锛歗[\u4e00-\u9fa5]{0,}$
2. 鑻辨枃鍜屾暟瀛楋細^[A-Za-z0-9]+$ 鎴 ^[A-Za-z0-9]{4,40}$
3. 闀垮害涓3-20鐨勬墍鏈夊瓧绗︼細^.{3,20}$
4. 鐢26涓嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓诧細^[A-Za-z]+$
5. 鐢26涓ぇ鍐欒嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓诧細^[A-Z]+$
6. 鐢26涓皬鍐欒嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓诧細^[a-z]+$
7. 鐢辨暟瀛楀拰26涓嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓诧細^[A-Za-z0-9]+$
8. 鐢辨暟瀛椼26涓嫳鏂囧瓧姣嶆垨鑰呬笅鍒掔嚎缁勬垚鐨勫瓧绗︿覆锛歗\w+$ 鎴 ^\w{3,20}$
9. 涓枃銆佽嫳鏂囥佹暟瀛楀寘鎷笅鍒掔嚎锛歗[\u4E00-\u9FA5A-Za-z0-9_]+$
10. 涓枃銆佽嫳鏂囥佹暟瀛椾絾涓嶅寘鎷笅鍒掔嚎绛夌鍙凤細^[\u4E00-\u9FA5A-Za-z0-9]+$ 鎴 ^[\u4E00-\u9FA5A-Za-z0-9]{2,20}$
11. 鍙互杈撳叆鍚湁^%&',;=?$\"绛夊瓧绗︼細[^%&',;=?$\x22]+ 12 绂佹杈撳叆鍚湁~鐨勫瓧绗︼細[^~\x22]+
鍏跺畠锛
.*鍖归厤闄 \n 浠ュ鐨勪换浣曞瓧绗︺
/[\u4E00-\u9FA5]/ 姹夊瓧
/[\uFF00-\uFFFF]/ 鍏ㄨ绗﹀彿
/[\u0000-\u00FF]/ 鍗婅绗﹀彿
涓夈佺壒娈婇渶姹傝〃杈惧紡
1. Email鍦板潃锛歗\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
2. 鍩熷悕锛歔a-zA-Z0-9][-a-zA-Z0-9]{0,62}(/.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+/.?
3. InternetURL锛歔a-zA-z]+://[^\s]* 鎴 ^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$
4. 鎵嬫満鍙风爜锛歗(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
5. 鐢佃瘽鍙风爜("XXX-XXXXXXX"銆"XXXX-XXXXXXXX"銆"XXX-XXXXXXX"銆"XXX-XXXXXXXX"銆"XXXXXXX"鍜"XXXXXXXX)锛歗(\(\d{3,4}-)|\d{3.4}-)?\d{7,8}$
6. 鍥藉唴鐢佃瘽鍙风爜(0511-4405222銆021-87888822)锛歕d{3}-\d{8}|\d{4}-\d{7}
7. 韬唤璇佸彿(15浣嶃18浣嶆暟瀛)锛歗\d{15}|\d{18}$
8. 鐭韩浠借瘉鍙风爜(鏁板瓧銆佸瓧姣峹缁撳熬)锛歗([0-9]){7,18}(x|X)?$ 鎴 ^\d{8,18}|[0-9x]{8,18}|[0-9X]{8,18}?$
9. 甯愬彿鏄惁鍚堟硶(瀛楁瘝寮澶达紝鍏佽5-16瀛楄妭锛屽厑璁稿瓧姣嶆暟瀛椾笅鍒掔嚎)锛歗[a-zA-Z][a-zA-Z0-9_]{4,15}$
10. 瀵嗙爜(浠ュ瓧姣嶅紑澶达紝闀垮害鍦6~18涔嬮棿锛屽彧鑳藉寘鍚瓧姣嶃佹暟瀛楀拰涓嬪垝绾)锛歗[a-zA-Z]\w{5,17}$
11. 寮哄瘑鐮(蹇呴』鍖呭惈澶у皬鍐欏瓧姣嶅拰鏁板瓧鐨勭粍鍚堬紝涓嶈兘浣跨敤鐗规畩瀛楃锛岄暱搴﹀湪8-10涔嬮棿)锛歗(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$
12. 鏃ユ湡鏍煎紡锛歗\d{4}-\d{1,2}-\d{1,2}
13. 涓骞寸殑12涓湀(01锝09鍜1锝12)锛歗(0?[1-9]|1[0-2])$
14. 涓涓湀鐨31澶(01锝09鍜1锝31)锛歗((0?[1-9])|((1|2)[0-9])|30|31)$
15. 閽辩殑杈撳叆鏍煎紡锛
16. 1.鏈夊洓绉嶉挶鐨勮〃绀哄舰寮忔垜浠彲浠ユ帴鍙:"10000.00" 鍜 "10,000.00", 鍜屾病鏈 "鍒" 鐨 "10000" 鍜 "10,000"锛歗[1-9][0-9]*$
17. 2.杩欒〃绀轰换鎰忎竴涓笉浠0寮澶寸殑鏁板瓧,浣嗘槸,杩欎篃鎰忓懗鐫涓涓瓧绗"0"涓嶉氳繃,鎵浠ユ垜浠噰鐢ㄤ笅闈㈢殑褰㈠紡锛歗(0|[1-9][0-9]*)$
18. 3.涓涓0鎴栬呬竴涓笉浠0寮澶寸殑鏁板瓧.鎴戜滑杩樺彲浠ュ厑璁稿紑澶存湁涓涓礋鍙凤細^(0|-?[1-9][0-9]*)$
19. 4.杩欒〃绀轰竴涓0鎴栬呬竴涓彲鑳戒负璐熺殑寮澶翠笉涓0鐨勬暟瀛.璁╃敤鎴蜂互0寮澶村ソ浜.鎶婅礋鍙风殑涔熷幓鎺,鍥犱负閽辨讳笉鑳芥槸璐熺殑鍚.涓嬮潰鎴戜滑瑕佸姞鐨勬槸璇存槑鍙兘鐨勫皬鏁伴儴鍒嗭細^[0-9]+(.[0-9]+)?$
20. 5.蹇呴』璇存槑鐨勬槸,灏忔暟鐐瑰悗闈㈣嚦灏戝簲璇ユ湁1浣嶆暟,鎵浠"10."鏄笉閫氳繃鐨,浣嗘槸 "10" 鍜 "10.2" 鏄氳繃鐨勶細^[0-9]+(.[0-9]{2})?$
21. 6.杩欐牱鎴戜滑瑙勫畾灏忔暟鐐瑰悗闈㈠繀椤绘湁涓や綅,濡傛灉浣犺涓哄お鑻涘埢浜,鍙互杩欐牱锛歗[0-9]+(.[0-9]{1,2})?$
22. 7.杩欐牱灏卞厑璁哥敤鎴峰彧鍐欎竴浣嶅皬鏁.涓嬮潰鎴戜滑璇ヨ冭檻鏁板瓧涓殑閫楀彿浜,鎴戜滑鍙互杩欐牱锛歗[0-9]{1,3}(,[0-9]{3})*(.[0-9]{1,2})?$
23 8.1鍒3涓暟瀛,鍚庨潰璺熺潃浠绘剰涓 閫楀彿+3涓暟瀛,閫楀彿鎴愪负鍙,鑰屼笉鏄繀椤伙細^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(.[0-9]{1,2})?$
24. 澶囨敞锛氳繖灏辨槸鏈缁堢粨鏋滀簡,鍒繕浜"+"鍙互鐢"*"鏇夸唬濡傛灉浣犺寰楃┖瀛楃涓蹭篃鍙互鎺ュ彈鐨勮瘽(濂囨,涓轰粈涔?)鏈鍚,鍒繕浜嗗湪鐢ㄥ嚱鏁版椂鍘绘帀鍘绘帀閭d釜鍙嶆枩鏉,涓鑸殑閿欒閮藉湪杩欓噷
25. xml鏂囦欢锛歗([a-zA-Z]+-?)+[a-zA-Z0-9]+\\.[x|X][m|M][l|L]$
26. 涓枃瀛楃鐨勬鍒欒〃杈惧紡锛歔\u4e00-\u9fa5]
27. 鍙屽瓧鑺傚瓧绗︼細[^\x00-\xff] (鍖呮嫭姹夊瓧鍦ㄥ唴锛屽彲浠ョ敤鏉ヨ绠楀瓧绗︿覆鐨勯暱搴(涓涓弻瀛楄妭瀛楃闀垮害璁2锛孉SCII瀛楃璁1))
28. 绌虹櫧琛岀殑姝e垯琛ㄨ揪寮忥細\n\s*\r (鍙互鐢ㄦ潵鍒犻櫎绌虹櫧琛)
29. HTML鏍囪鐨勬鍒欒〃杈惧紡锛<(\S*?)[^>]*>.*?</\1>|<.*? /> (缃戜笂娴佷紶鐨勭増鏈お绯熺硶锛屼笂闈㈣繖涓篃浠呬粎鑳介儴鍒嗭紝瀵逛簬澶嶆潅鐨勫祵濂楁爣璁颁緷鏃ф棤鑳戒负鍔)
30. 棣栧熬绌虹櫧瀛楃鐨勬鍒欒〃杈惧紡锛歗\s*|\s*$鎴(^\s*)|(\s*$) (鍙互鐢ㄦ潵鍒犻櫎琛岄琛屽熬鐨勭┖鐧藉瓧绗(鍖呮嫭绌烘牸銆佸埗琛ㄧ銆佹崲椤电绛夌瓑)锛岄潪甯告湁鐢ㄧ殑琛ㄨ揪寮)
31. 鑵捐QQ鍙凤細[1-9][0-9]{4,} (鑵捐QQ鍙蜂粠10000寮濮)
32. 涓浗閭斂缂栫爜锛歔1-9]\d{5}(?!\d) (涓浗閭斂缂栫爜涓6浣嶆暟瀛)
33. IP鍦板潃锛歕d+\.\d+\.\d+\.\d+ (鎻愬彇IP鍦板潃鏃舵湁鐢)
34. IP鍦板潃锛((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))
35. IP-v4鍦板潃锛歕\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b (鎻愬彇IP鍦板潃鏃舵湁鐢)
36. 鏍¢獙IP-v6鍦板潃:(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))
37. 瀛愮綉鎺╃爜锛((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))
38. 鏍¢獙鏃ユ湡:^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$(鈥測yyy-mm-dd鈥 鏍煎紡鐨勬棩鏈熸牎楠岋紝宸茶冭檻骞抽棸骞淬)
39. 鎶藉彇娉ㄩ噴锛<!--(.*?)-->
40. 鏌ユ壘CSS灞炴:^\\s*[a-zA-Z\\-]+\\s*[:]{1}\\s[a-zA-Z0-9\\s.#]+[;]{1}
41. 鎻愬彇椤甸潰瓒呴摼鎺:(<a\\s*(?!.*\\brel=)[^>]*)(href="https?:\\/\\/)((?!(?:(?:www\\.)?'.implode('|(?:www\\.)?', $follow_list).'))[^" rel="external nofollow" ]+)"((?!.*\\brel=)[^>]*)(?:[^>]*)>
42. 鎻愬彇缃戦〉鍥剧墖:\\< *[img][^\\\\>]*[src] *= *[\\"\\']{0,1}([^\\"\\'\\ >]*)
43. 鎻愬彇缃戦〉棰滆壊浠g爜:^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
44. 鏂囦欢鎵╁睍鍚嶆晥楠:^([a-zA-Z]\\:|\\\\)\\\\([^\\\\]+\\\\)*[^\\/:*?"<>|]+\\.txt(l)?$
45. 鍒ゆ柇IE鐗堟湰锛歗.*MSIE [5-8](?:\\.[0-9]+)?(?!.*Trident\\/[5-9]\\.0).*$
鍏冨瓧绗
鎻忚堪
\
灏嗕笅涓涓瓧绗︽爣璁扮銆佹垨涓涓悜鍚庡紩鐢ㄣ佹垨涓涓叓杩涘埗杞箟绗︺備緥濡傦紝鈥淺\n鈥濆尮閰峔n銆傗淺n鈥濆尮閰嶆崲琛岀銆傚簭鍒椻淺\鈥濆尮閰嶁淺鈥濊屸淺(鈥濆垯鍖归厤鈥(鈥濄傚嵆鐩稿綋浜庡绉嶇紪绋嬭瑷涓兘鏈夌殑鈥滆浆涔夊瓧绗︹濈殑姒傚康銆
^
鍖归厤杈撳叆瀛楄棣栥傚鏋滆缃簡RegExp瀵硅薄鐨凪ultiline灞炴э紝^涔熷尮閰嶁淺n鈥濇垨鈥淺r鈥濅箣鍚庣殑浣嶇疆銆
$
鍖归厤杈撳叆琛屽熬銆傚鏋滆缃簡RegExp瀵硅薄鐨凪ultiline灞炴э紝$涔熷尮閰嶁淺n鈥濇垨鈥淺r鈥濅箣鍓嶇殑浣嶇疆銆
*
鍖归厤鍓嶉潰鐨勫瓙琛ㄨ揪寮忎换鎰忔銆備緥濡傦紝zo*鑳藉尮閰嶁渮鈥濓紝涔熻兘鍖归厤鈥渮o鈥濅互鍙娾渮oo鈥濄*绛変环浜巤0,}銆
+
鍖归厤鍓嶉潰鐨勫瓙琛ㄨ揪寮忎竴娆℃垨澶氭(澶т簬绛変簬1娆★級銆備緥濡傦紝鈥渮o+鈥濊兘鍖归厤鈥渮o鈥濅互鍙娾渮oo鈥濓紝浣嗕笉鑳藉尮閰嶁渮鈥濄+绛変环浜巤1,}銆
?
鍖归厤鍓嶉潰鐨勫瓙琛ㄨ揪寮忛浂娆℃垨涓娆°備緥濡傦紝鈥渄o(es)?鈥濆彲浠ュ尮閰嶁渄o鈥濇垨鈥渄oes鈥濄?绛変环浜巤0,1}銆
{n}
n鏄竴涓潪璐熸暣鏁般傚尮閰嶇‘瀹氱殑n娆°備緥濡傦紝鈥渙{2}鈥濅笉鑳藉尮閰嶁淏ob鈥濅腑鐨勨渙鈥濓紝浣嗘槸鑳藉尮閰嶁渇ood鈥濅腑鐨勪袱涓猳銆
{n,}
n鏄竴涓潪璐熸暣鏁般傝嚦灏戝尮閰峮娆°備緥濡傦紝鈥渙{2,}鈥濅笉鑳藉尮閰嶁淏ob鈥濅腑鐨勨渙鈥濓紝浣嗚兘鍖归厤鈥渇oooood鈥濅腑鐨勬墍鏈塷銆傗渙{1,}鈥濈瓑浠蜂簬鈥渙+鈥濄傗渙{0,}鈥濆垯绛変环浜庘渙*鈥濄
{n,m}
m鍜宯鍧囦负闈炶礋鏁存暟锛屽叾涓璶<=m銆傛渶灏戝尮閰峮娆′笖鏈澶氬尮閰峬娆°備緥濡傦紝鈥渙{1,3}鈥濆皢鍖归厤鈥渇ooooood鈥濅腑鐨勫墠涓変釜o涓轰竴缁勶紝鍚庝笁涓猳涓轰竴缁勩傗渙{0,1}鈥濈瓑浠蜂簬鈥渙?鈥濄傝娉ㄦ剰鍦ㄩ楀彿鍜屼袱涓暟涔嬮棿涓嶈兘鏈夌┖鏍笺
?
褰撹瀛楃绱ц窡鍦ㄤ换浣曚竴涓叾浠栭檺鍒剁锛*,+,?锛寋n}锛寋n,}锛寋n,m}锛夊悗闈㈡椂锛屽尮閰嶆ā寮忔槸闈炶椽濠殑銆傞潪璐┆妯″紡灏藉彲鑳藉皯鍦板尮閰嶆墍鎼滅储鐨勫瓧绗︿覆锛岃岄粯璁ょ殑璐┆妯″紡鍒欏敖鍙兘澶氬湴鍖归厤鎵鎼滅储鐨勫瓧绗︿覆銆備緥濡傦紝瀵逛簬瀛楃涓测渙ooo鈥濓紝鈥渙+鈥濆皢灏藉彲鑳藉鍦板尮閰嶁渙鈥濓紝寰楀埌缁撴灉[鈥渙ooo鈥漖锛岃屸渙+?鈥濆皢灏藉彲鑳藉皯鍦板尮閰嶁渙鈥濓紝寰楀埌缁撴灉 ['o', 'o', 'o', 'o']
.鐐
鍖归厤闄も淺n鈥濆拰"\r"涔嬪鐨勪换浣曞崟涓瓧绗︺傝鍖归厤鍖呮嫭鈥淺n鈥濆拰"\r"鍦ㄥ唴鐨勪换浣曞瓧绗︼紝璇蜂娇鐢ㄥ儚鈥淸\s\S]鈥濈殑妯″紡銆
(pattern)
鍖归厤pattern骞惰幏鍙栬繖涓鍖归厤銆傛墍鑾峰彇鐨勫尮閰嶅彲浠ヤ粠浜х敓鐨凪atches闆嗗悎寰楀埌锛屽湪VBScript涓娇鐢⊿ubMatches闆嗗悎锛屽湪JScript涓垯浣跨敤$0鈥$9灞炴с傝鍖归厤鍦嗘嫭鍙峰瓧绗︼紝璇蜂娇鐢ㄢ溾濇垨鈥溾濄
(?:pattern)
闈炶幏鍙栧尮閰嶏紝鍖归厤pattern浣嗕笉鑾峰彇鍖归厤缁撴灉锛屼笉杩涜瀛樺偍渚涗互鍚庝娇鐢ㄣ傝繖鍦ㄤ娇鐢ㄦ垨瀛楃鈥(|)鈥濇潵缁勫悎涓涓ā寮忕殑鍚勪釜閮ㄥ垎鏃跺緢鏈夌敤銆備緥濡傗渋ndustr(?:y|ies)鈥濆氨鏄竴涓瘮鈥渋ndustry|industries鈥濇洿绠鐣ョ殑琛ㄨ揪寮忋
(?=pattern)
闈炶幏鍙栧尮閰嶏紝姝e悜鑲畾棰勬煡锛屽湪浠讳綍鍖归厤pattern鐨勫瓧绗︿覆寮濮嬪鍖归厤鏌ユ壘瀛楃涓诧紝璇ュ尮閰嶄笉闇瑕佽幏鍙栦緵浠ュ悗浣跨敤銆備緥濡傦紝鈥淲indows(?=95|98|NT|2000)鈥濊兘鍖归厤鈥淲indows2000鈥濅腑鐨勨淲indows鈥濓紝浣嗕笉鑳藉尮閰嶁淲indows3.1鈥濅腑鐨勨淲indows鈥濄傞鏌ヤ笉娑堣楀瓧绗︼紝涔熷氨鏄锛屽湪涓涓尮閰嶅彂鐢熷悗锛屽湪鏈鍚庝竴娆″尮閰嶄箣鍚庣珛鍗冲紑濮嬩笅涓娆″尮閰嶇殑鎼滅储锛岃屼笉鏄粠鍖呭惈棰勬煡鐨勫瓧绗︿箣鍚庡紑濮嬨
(?!pattern)
闈炶幏鍙栧尮閰嶏紝姝e悜鍚﹀畾棰勬煡锛屽湪浠讳綍涓嶅尮閰峱attern鐨勫瓧绗︿覆寮濮嬪鍖归厤鏌ユ壘瀛楃涓诧紝璇ュ尮閰嶄笉闇瑕佽幏鍙栦緵浠ュ悗浣跨敤銆備緥濡傗淲indows(?!95|98|NT|2000)鈥濊兘鍖归厤鈥淲indows3.1鈥濅腑鐨勨淲indows鈥濓紝浣嗕笉鑳藉尮閰嶁淲indows2000鈥濅腑鐨勨淲indows鈥濄
(?<=pattern)
闈炶幏鍙栧尮閰嶏紝鍙嶅悜鑲畾棰勬煡锛屼笌姝e悜鑲畾棰勬煡绫讳技锛屽彧鏄柟鍚戠浉鍙嶃備緥濡傦紝鈥(?<=95|98|NT|2000)Windows鈥濊兘鍖归厤鈥2000Windows鈥濅腑鐨勨淲indows鈥濓紝浣嗕笉鑳藉尮閰嶁3.1Windows鈥濅腑鐨勨淲indows鈥濄
*python鐨勬鍒欒〃杈惧紡娌℃湁瀹屽叏鎸夌収姝e垯琛ㄨ揪寮忚鑼冨疄鐜帮紝鎵浠ヤ竴浜涢珮绾х壒鎬у缓璁娇鐢ㄥ叾浠栬瑷濡俲ava銆乻cala绛
(?<!patte_n)
闈炶幏鍙栧尮閰嶏紝鍙嶅悜鍚﹀畾棰勬煡锛屼笌姝e悜鍚﹀畾棰勬煡绫讳技锛屽彧鏄柟鍚戠浉鍙嶃備緥濡傗(?<!95|98|NT|2000)Windows鈥濊兘鍖归厤鈥3.1Windows鈥濅腑鐨勨淲indows鈥濓紝浣嗕笉鑳藉尮閰嶁2000Windows鈥濅腑鐨勨淲indows鈥濄
*python鐨勬鍒欒〃杈惧紡娌℃湁瀹屽叏鎸夌収姝e垯琛ㄨ揪寮忚鑼冨疄鐜帮紝鎵浠ヤ竴浜涢珮绾х壒鎬у缓璁娇鐢ㄥ叾浠栬瑷濡俲ava銆乻cala绛
x|y
鍖归厤x鎴杫銆備緥濡傦紝鈥渮|food鈥濊兘鍖归厤鈥渮鈥濇垨鈥渇ood鈥(姝ゅ璇疯皑鎱)銆傗淸z|f]ood鈥濆垯鍖归厤鈥渮ood鈥濇垨鈥渇ood鈥濄
[xyz]
瀛楃闆嗗悎銆傚尮閰嶆墍鍖呭惈鐨勪换鎰忎竴涓瓧绗︺備緥濡傦紝鈥淸abc]鈥濆彲浠ュ尮閰嶁減lain鈥濅腑鐨勨渁鈥濄
[^xyz]
璐熷煎瓧绗﹂泦鍚堛傚尮閰嶆湭鍖呭惈鐨勪换鎰忓瓧绗︺備緥濡傦紝鈥淸^abc]鈥濆彲浠ュ尮閰嶁減lain鈥濅腑鐨勨減lin鈥濅换涓瀛楃銆
[a-z]
瀛楃鑼冨洿銆傚尮閰嶆寚瀹氳寖鍥村唴鐨勪换鎰忓瓧绗︺備緥濡傦紝鈥淸a-z]鈥濆彲浠ュ尮閰嶁渁鈥濆埌鈥渮鈥濊寖鍥村唴鐨勪换鎰忓皬鍐欏瓧姣嶅瓧绗︺
娉ㄦ剰:鍙湁杩炲瓧绗﹀湪瀛楃缁勫唴閮ㄦ椂,骞朵笖鍑虹幇鍦ㄤ袱涓瓧绗︿箣闂存椂,鎵嶈兘琛ㄧず瀛楃鐨勮寖鍥; 濡傛灉鍑哄瓧绗︾粍鐨勫紑澶,鍒欏彧鑳借〃绀鸿繛瀛楃鏈韩.
[^a-z]
璐熷煎瓧绗﹁寖鍥淬傚尮閰嶄换浣曚笉鍦ㄦ寚瀹氳寖鍥村唴鐨勪换鎰忓瓧绗︺備緥濡傦紝鈥淸^a-z]鈥濆彲浠ュ尮閰嶄换浣曚笉鍦ㄢ渁鈥濆埌鈥渮鈥濊寖鍥村唴鐨勪换鎰忓瓧绗︺
\b
鍖归厤涓涓崟璇嶇殑杈圭晫锛屼篃灏辨槸鎸囧崟璇嶅拰绌烘牸闂寸殑浣嶇疆锛堝嵆姝e垯琛ㄨ揪寮忕殑鈥滃尮閰嶁濇湁涓ょ姒傚康锛屼竴绉嶆槸鍖归厤瀛楃锛屼竴绉嶆槸鍖归厤浣嶇疆锛岃繖閲岀殑\b灏辨槸鍖归厤浣嶇疆鐨勶級銆備緥濡傦紝鈥渆r\b鈥濆彲浠ュ尮閰嶁渘ever鈥濅腑鐨勨渆r鈥濓紝浣嗕笉鑳藉尮閰嶁渧erb鈥濅腑鐨勨渆r鈥濓紱鈥淺b1_鈥濆彲浠ュ尮閰嶁1_23鈥濅腑鐨勨1_鈥濓紝浣嗕笉鑳藉尮閰嶁21_3鈥濅腑鐨勨1_鈥濄
\B
鍖归厤闈炲崟璇嶈竟鐣屻傗渆r\B鈥濊兘鍖归厤鈥渧erb鈥濅腑鐨勨渆r鈥濓紝浣嗕笉鑳藉尮閰嶁渘ever鈥濅腑鐨勨渆r鈥濄
\cx
鍖归厤鐢眡鎸囨槑鐨勬帶鍒跺瓧绗︺備緥濡傦紝\cM鍖归厤涓涓狢ontrol-M鎴栧洖杞︾銆倄鐨勫煎繀椤讳负A-Z鎴朼-z涔嬩竴銆傚惁鍒欙紝灏哻瑙嗕负涓涓師涔夌殑鈥渃鈥濆瓧绗︺
\d
鍖归厤涓涓暟瀛楀瓧绗︺傜瓑浠蜂簬[0-9]銆俫rep 瑕佸姞涓-P锛宲erl姝e垯鏀寔
\D
鍖归厤涓涓潪鏁板瓧瀛楃銆傜瓑浠蜂簬[^0-9]銆俫rep瑕佸姞涓-P锛宲erl姝e垯鏀寔
\f
鍖归厤涓涓崲椤电銆傜瓑浠蜂簬\x0c鍜孿cL銆
\n
鍖归厤涓涓崲琛岀銆傜瓑浠蜂簬\x0a鍜孿cJ銆
\r
鍖归厤涓涓洖杞︾銆傜瓑浠蜂簬\x0d鍜孿cM銆
\s
鍖归厤浠讳綍涓嶅彲瑙佸瓧绗︼紝鍖呮嫭绌烘牸銆佸埗琛ㄧ銆佹崲椤电绛夌瓑銆傜瓑浠蜂簬[ \f\n\r\t\v]銆
\S
鍖归厤浠讳綍鍙瀛楃銆傜瓑浠蜂簬[^ \f\n\r\t\v]銆
\t
鍖归厤涓涓埗琛ㄧ銆傜瓑浠蜂簬\x09鍜孿cI銆
\v
鍖归厤涓涓瀭鐩村埗琛ㄧ銆傜瓑浠蜂簬\x0b鍜孿cK銆
\w
鍖归厤鍖呮嫭涓嬪垝绾跨殑浠讳綍鍗曡瘝瀛楃銆傜被浼间絾涓嶇瓑浠蜂簬鈥淸A-Za-z0-9_]鈥濓紝杩欓噷鐨"鍗曡瘝"瀛楃浣跨敤Unicode瀛楃闆嗐
\W
鍖归厤浠讳綍闈炲崟璇嶅瓧绗︺傜瓑浠蜂簬鈥淸^A-Za-z0-9_]鈥濄
\xn
鍖归厤n锛屽叾涓璶涓哄崄鍏繘鍒惰浆涔夊笺傚崄鍏繘鍒惰浆涔夊煎繀椤讳负纭畾鐨勪袱涓暟瀛楅暱銆備緥濡傦紝鈥淺x41鈥濆尮閰嶁淎鈥濄傗淺x041鈥濆垯绛変环浜庘淺x04&1鈥濄傛鍒欒〃杈惧紡涓彲浠ヤ娇鐢ˋSCII缂栫爜銆
\num
鍖归厤num锛屽叾涓璶um鏄竴涓鏁存暟銆傚鎵鑾峰彇鐨勫尮閰嶇殑寮曠敤銆備緥濡傦紝鈥(.)\1鈥濆尮閰嶄袱涓繛缁殑鐩稿悓瀛楃銆
\n
鏍囪瘑涓涓叓杩涘埗杞箟鍊兼垨涓涓悜鍚庡紩鐢ㄣ傚鏋淺n涔嬪墠鑷冲皯n涓幏鍙栫殑瀛愯〃杈惧紡锛屽垯n涓哄悜鍚庡紩鐢ㄣ傚惁鍒欙紝濡傛灉n涓哄叓杩涘埗鏁板瓧锛0-7锛夛紝鍒檔涓轰竴涓叓杩涘埗杞箟鍊笺
\nm
鏍囪瘑涓涓叓杩涘埗杞箟鍊兼垨涓涓悜鍚庡紩鐢ㄣ傚鏋淺nm涔嬪墠鑷冲皯鏈塶m涓幏寰楀瓙琛ㄨ揪寮忥紝鍒檔m涓哄悜鍚庡紩鐢ㄣ傚鏋淺nm涔嬪墠鑷冲皯鏈塶涓幏鍙栵紝鍒檔涓轰竴涓悗璺熸枃瀛梞鐨勫悜鍚庡紩鐢ㄣ傚鏋滃墠闈㈢殑鏉′欢閮戒笉婊¤冻锛岃嫢n鍜宮鍧囦负鍏繘鍒舵暟瀛楋紙0-7锛夛紝鍒橽nm灏嗗尮閰嶅叓杩涘埗杞箟鍊糿m銆
\nml
濡傛灉n涓哄叓杩涘埗鏁板瓧锛0-7锛夛紝涓攎鍜宭鍧囦负鍏繘鍒舵暟瀛楋紙0-7锛夛紝鍒欏尮閰嶅叓杩涘埗杞箟鍊糿ml銆
\un
鍖归厤n锛屽叾涓璶鏄竴涓敤鍥涗釜鍗佸叚杩涘埗鏁板瓧琛ㄧず鐨刄nicode瀛楃銆備緥濡傦紝\u00A9鍖归厤鐗堟潈绗﹀彿锛埪╋級銆
\p{P}
灏忓啓 p 鏄 property 鐨勬剰鎬濓紝琛ㄧず Unicode 灞炴э紝鐢ㄤ簬 Unicode 姝h〃杈惧紡鐨勫墠缂銆備腑鎷彿鍐呯殑鈥淧鈥濊〃绀篣nicode 瀛楃闆嗕竷涓瓧绗﹀睘鎬т箣涓锛氭爣鐐瑰瓧绗︺
鍏朵粬鍏釜灞炴э細
L锛氬瓧姣嶏紱
M锛氭爣璁扮鍙凤紙涓鑸笉浼氬崟鐙嚭鐜帮級锛
Z锛氬垎闅旂锛堟瘮濡傜┖鏍笺佹崲琛岀瓑锛夛紱
S锛氱鍙凤紙姣斿鏁板绗﹀彿銆佽揣甯佺鍙风瓑锛夛紱
N锛氭暟瀛楋紙姣斿闃挎媺浼暟瀛椼佺綏椹暟瀛楃瓑锛夛紱
C锛氬叾浠栧瓧绗︺
*娉細姝よ娉曢儴鍒嗚瑷涓嶆敮鎸侊紝渚嬶細javascript銆
\<
\>
鍖归厤璇嶏紙word锛夌殑寮濮嬶紙\<锛夊拰缁撴潫锛圽>锛夈備緥濡傛鍒欒〃杈惧紡\<the\>鑳藉鍖归厤瀛楃涓"for the wise"涓殑"the"锛屼絾鏄笉鑳藉尮閰嶅瓧绗︿覆"otherwise"涓殑"the"銆傛敞鎰忥細杩欎釜鍏冨瓧绗︿笉鏄墍鏈夌殑杞欢閮芥敮鎸佺殑銆
( ) 灏( 鍜 ) 涔嬮棿鐨勮〃杈惧紡瀹氫箟涓衡滅粍鈥濓紙group锛夛紝骞朵笖灏嗗尮閰嶈繖涓〃杈惧紡鐨勫瓧绗︿繚瀛樺埌涓涓复鏃跺尯鍩燂紙涓涓鍒欒〃杈惧紡涓渶澶氬彲浠ヤ繚瀛9涓級锛屽畠浠彲浠ョ敤 \1 鍒癨9 鐨勭鍙锋潵寮曠敤銆
| 灏嗕袱涓尮閰嶆潯浠惰繘琛岄昏緫鈥滄垨鈥濓紙or锛夎繍绠椼備緥濡傛鍒欒〃杈惧紡(him|her) 鍖归厤"it belongs to him"鍜"it belongs to her"锛屼絾鏄笉鑳藉尮閰"it belongs to them."銆傛敞鎰忥細杩欎釜鍏冨瓧绗︿笉鏄墍鏈夌殑杞欢閮芥敮鎸佺殑銆
PS:
https:///regexp/regexp-tutorial.html
鍦ㄧ嚎姝e垯琛ㄨ揪寮忔祴璇: http://tool.oschina.net/regex/