Regex Pal

Dan's Tools

ipv4 Regex

0.0.0.0 8 本網路(僅作為源位址時合法) RFC 5735 10.0.0.0 8 專用網路 RFC 1918 100.64.0.0 10 電信級NAT RFC 6598 127.0.0.0 8 環回 RFC 5735 169.254.0.0 16 鏈路本地 RFC 3927 172.16.0.0 12 專用網路 RFC 1918 192.0.0.0 24 保留(IANA) RFC 5735 192.0.2.0 24 TEST-NET-1,文件和範例 RFC 5735 192.88.99.0 24 6to4中繼 RFC 3068 192.168.0.0 16 專用網路 RFC 1918 198.18.0.0 15 網路基準測試 RFC 2544 198.51.100.0 24 TEST-NET-2,文件和範例 RFC 5737 203.0.113.0 24 TEST-NET-3,文件和範例 RFC 5737 224.0.0.0 4 多播(之前的D類網路) RFC 3171 240.0.0.0 4 保留(之前的E類網路) RFC 1700 255.255.255.255 受限廣播 RFC 919

Comments

Top Regular Expressions

Cheat Sheet

Character classes
. any character except newline
\w \d \s word, digit, whitespace
\W \D \S not word, digit, whitespace
[abc] any of a, b, or c
[^abc] not a, b, or c
[a-g] character between a & g
Anchors
^abc$ start / end of the string
\b word boundary
Escaped characters
\. \* \\ escaped special characters
\t \n \r tab, linefeed, carriage return
\u00A9 unicode escaped ©
Groups & Lookaround
(abc) capture group
\1 backreference to group #1
(?:abc) non-capturing group
(?=abc) positive lookahead
(?!abc) negative lookahead
Quantifiers & Alternation
a* a+ a? 0 or more, 1 or more, 0 or 1
a{5} a{2,} exactly five, two or more
a{1,3} between one & three
a+? a{2,}? match as few as possible
ab|cd match ab or cd