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
| // WARNING: These code may be incorrect and may not be production ready, so use at your own risk. | |
| export const dotDecimalIPv4Regex = /^((25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)$/; | |
| const dottedComponentRegex = /^((0(?:x|X)[a-fA-F0-9]+)|(0[0-7]*)|([1-9]\d*))$/; | |
| export function isIPv4(s: string): boolean { | |
| const decimals = s.split('.'); | |
| // https://stackoverflow.com/questions/10133820/is-there-any-documentation-for-omitting-zeroes-in-dot-decimal-notation-of-ipv4-a | |
| // https://linux.die.net/man/3/inet_aton |
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
| const d8 = '25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d'; | |
| export const ipv4RegStr = `((${d8})\\.){3}(${d8})` | |
| export const ipv4Matcher = new RegExp(ipv4RegStr, 'g'); | |
| export const ipv4Validator = new RegExp(`^(${ipv4RegStr})$`); | |
| // https://stackoverflow.com/questions/14638711/regular-expression-for-ipv6-addresses |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>HNote Data v2</title> | |
| </head> | |
| <body> | |
| <style> | |
| body { |
OlderNewer