Regular Expressions 101

Sponsors

Library entries

1
pcre

gfghfgdf

no description available
Submitted by anonymous - 7 years ago
1
pcre

Get a xls file from URL

no description available
Submitted by Huan - 7 years ago
2
pcre

inline img

no description available
Submitted by anonymous - 7 years ago
1
pcre

viduregex

cac vi du ve bat cac chuoi o regex
Submitted by thieutham - 7 years ago
1
pcre

viduregex

cac vi du ve bat cac chuoi o regex
Submitted by thieutham - 7 years ago
2
pcre

remove n lines after matching pattern

stackoverflow question
Submitted by irom77 - 7 years ago
3
pcre

currency

no description available
Submitted by anonymous - 7 years ago
1
javascript

US Zip Code Validation

5 digits and no 0 5/4 times
Submitted by Ashish - 7 years ago
0
javascript

Date Validation

no description available
Submitted by Ashish - 7 years ago
-2
javascript

Date Validation

no description available
Submitted by anonymous - 7 years ago
1
pcre

URL detector

no description available
Submitted by pawel - 7 years ago

ipv4 IP addressses, capturing private ranges

Vote

1

Regular Expression
pcre

/
# 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 - 7 years ago