has-ipv6
Returns a value indicating whether one of specified IPv6 addresses appears in a text.
IP-prefix notation is a concise way of representing an IP address and its associated network mask. The format is /, where the prefix length is the number of leading 1 bits in the netmask. The prefix length determines the range of IP addresses that belong to the network.
For IPv6, the prefix length is a number between 0 and 128. So the notation fe80::85d:e82c:9446:7994/120 represents the IP address fe80::85d:e82c:9446:7994 with a netmask of ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff00. This netmask has 120 leading 1 bits, or a prefix length of 120.
Syntax
has_ipv6(
text ,
ip_addresses )
Arguments
- text: The value containing the text to search in.
- ip_address: String value containing the IP address to look for.
Returns
true
if one of specified IP addresses is a valid IPv4 address, and it was found in text. Otherwise, the function returns false
.
Example 1
Examaple to show string contains the specified ipv6 address.
print has_ipv6('05:04:54 fe80::85d:e82c:9446:7994 GET /favicon.ico 404', 'fe80::85d:e82c:9446:7994') // true
Returns
print_0 |
---|
1 |
Example 2
Examaple to show string contains invalid ipv6 address.
print has_ipv6('05:04:54 ":fe80::85d:e82c:9446" GET /favicon.ico 404', dynamic([":ffff:c0a8:01f", "192.168.1.1"])) // false, invalid IPv6 address
Returns
print_0 |
---|
0 |
Example 3
Examaple to show string contains inproperly delimited ipv6 address.
print has_ipv6('05:04:54fe80::85d:e82c:9446:7994 GET /favicon.ico 404', 'fe80::85d:e82c:9446:7994') // false, improperly delimited IP address
Returns
print_0 |
---|
0 |