Created
August 21, 2021 19:41
-
-
Save thefury/79a9f147482090371c0aaf8807087dd8 to your computer and use it in GitHub Desktop.
Simple ruby IP check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def valid?(ip) | |
| rgx=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ | |
| ip.match(rgx) != nil | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment