Skip to content

Latest commit

 

History

History
46 lines (28 loc) · 747 Bytes

常用正则.md

File metadata and controls

46 lines (28 loc) · 747 Bytes

匹配行首:

^

匹配行尾

$

匹配IP:

(\d{1,3}.){3}\d{1,3}

匹配全网址:

[a-zA-z]+://[^\s]* ^((http://)|(https://))?(a-zA-Z0-9?.)+[a-zA-Z]{2,6}(/)

匹配域名:

(a-zA-Z0-9?.)+[a-zA-Z]{2,6}(/) [a-zA-Z0-9][-a-zA-Z0-9]{0,62}(.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+.?/

匹配包含字符的行:

^.admin:.$

匹配空行:

^[ \t]*\n

匹配中文字符的正则表达式:

[\u4e00-\u9fa5]

匹配双字节字符(包括汉字在内):

[^\x00-\xff]

Google采集

var h3 = document.getElementsByTagName('h3');
for(var i=0;i<h3.length;i++){
    var a = h3[i]. getElementsByTagName('a');
    console.log(a[0].href);
}