Need Regex to find IPs from a string

Hi

I Have below mail body, i can able to read each line but i need to get all IPs from the mail body along with /32, /33,/34…so on.

Please help me …

mail Body:

List of Ips to be blocked.

IP List

203.159.80.131/32
203.159.80.131/33
203.159.80.131/34

Thanks,
Rafi

Hi,
Check:

System.Text.RegularExpressions.Regex.IsMatch(yourIP,"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/(32|33|34)")

1 Like

Hi
Thanks, But 32,33,34 not always same, this can be another number also.

Can you please help

Here is complete mail body

List of Ips to be blocked.

IP List

203.159.80.131/32

203.159.80.131/33

203.159.80.131/34

Thanks & Regards,

Utpal Shah
Technical Architect
M : +91 82961 12345

Maybe something like this:

System.Text.RegularExpressions.Regex.IsMatch(yourIP,"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/(\d.)")

Thanks, it Works…!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.