Method RegEx():createIPAddress() Foundation

Creates a RegEx instance for IP address validation.

Syntax
:createIPAddress( [<nVersion>] ) --> oRegEx
Parameters
<nVersion>
Specifies the IP version to use (either 4 or 6). The default is 4.
Return

The pre-configured RegEx object.

Description

Factory method that creates a pre-configured RegEx object for validating IP addresses. Supports both IPv4 and IPv6 formats.

IP address

oIPv4 := RegEx():createIPAddress(4) 
? oIPv4:test("192.168.1.1")  // .T. 
oIPv4:destroy() 

oIPv6 := RegEx():createIPAddress(6) 
? oIPv6:test("2001:0db8::8a2e:0370:7334")  // .T. 
oIPv6:destroy() 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.