Regular Expressions 101

Community Patterns

0

OS正则表达式

Java 8
zzx
Submitted by zzx - a year ago
0

DB

Java 8
DB
Submitted by DB - a year ago
0

Test Function Block

PCRE2 (PHP >=7.3)
Test
Submitted by anonymous - a year ago
0

括号匹配

Java 8
(\[]\])|(【】)|(())|(\(\))
Submitted by nasion - a year ago
0

Pan Number

PCRE2 (PHP >=7.3)
Pan Number
Submitted by anonymous - a year ago
0

GSTN

PCRE2 (PHP >=7.3)
Goods & Service Tax Numebr
Submitted by anonymous - a year ago
0

Money format

PCRE2 (PHP >=7.3)
Any money format
Submitted by anonymous - a year ago
0

IP Address

Java 8
IP Address RegEx
Submitted by anonymous - a year ago

ipv4 IP addressses, capturing private ranges

1

Regular Expression
PCRE (PHP <7.3)

/
# Match ipv4 IP addresses # Specifically capture private IPs before matching the more global # 0.0.0.0 - 255.255.255.255 octet ranges. ^(?P<private_10_ip> 10\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]) )$ | ^(?P<private_169_ip> 169\. 254\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]) )$ | ^(?P<private_172_ip> 172\. (?:1[6-9]|2[0-9]|3[0-1])\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]) )$ | ^(?P<private_192_ip> 192\. 168\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]) )$ | ^(?P<all_ip> (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])\. (?:[01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]) )$
/
gmx

Description

Loading markdown...
Submitted by OnlineCop - 8 years ago