GitHubContribute in GitHub: Edit online

has-any-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_any_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.

Examples

Example 1

String with a valid ipv6 address.


    print has_any_ipv6('05:04:54 fe80::85d:e82c:9446:7994 GET /favicon.ico 404', 'fe80::85d:e82c:9446:7994', '192.168.1.1') // true

 

Return

|print_0 |
|--------|
|1       |

 

Example 2

String with improperly delimited address.

    print has_any_ipv6('05:04:54fe80::85d:e82c:9446:7994 GET /favicon.ico 404', 'fe80::85d:e82c:9446:7994', '192.168.1.1') // false, improperly delimited IP address

 

Return

|print_0 |
|--------|
|0       |