Regular expression for validating ip address

It returns true if Ipv4 address is correct or vice-versa.

Does anyone have a regular expression handy that will match any legal DNS hostname or IP address?

category=Domain_FAQ&question=9 (any alphanumeric combination and '-' symbol, dash should not be in the beginning or end of an octet.

$pattern = '/^(([a-z0-9] |([a-z0-9] [-] [a-z0-9] ))[.]) (AC|AD|AE|AERO|AF|AG|AI|AL|AM|AN|AO|AQ|AR|ARPA|AS|ASIA|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BIZ|BJ|BM|BN|BO|BR|BS|BT|BV|BW|BY|BZ|CA|CAT|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|COM|COOP|CR|CU|CV|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EDU|EE|EG|ER|ES|ET|EU|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GOV|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|INFO|INT|IO|IQ|IR|IS|IT|JE|JM|JO|JOBS|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MG|MH|MIL|MK|ML|MM|MN|MO|MOBI|MP|MQ|MR|MS|MT|MU|MUSEUM|MV|MW|MX|MY|MZ|NA|NAME|NC|NE|NET|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|ORG|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PRO|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|ST|SU|SV|SY|SZ|TC|TD|TEL|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TP|TR|TRAVEL|TT|TV|TW|TZ|UA|UG|UK|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XN|XN|XN|XN|XN|XN|XN|XN|XN|XN|XN|YE|YT|YU|ZA|ZM|ZW)[.]? Why does it work only for From what I understood, I think it should be but, it is not working.

: # Start non-capture group (number 0-255 optional dot) (?

regular expression for validating ip address-53regular expression for validating ip address-76regular expression for validating ip address-35

Although this is better than for instances of the pattern, the repetition can be eliminated entirely if subroutines are supported in the regex being used.

However, a subsequent specification (RFC 1123) permitted hostname labels to start with digits. - I explain that names that start with a digit are considered as valid as well. It ignores RFC2181: "The DNS itself places only one restriction on the particular labels that can be used to identify resource records.

That one restriction relates to the length of the label and the full name.

By specifying abstract keyword just before class, we can make a class as abstract class.

public abstract class My Abstract Class Abstract class may or may not contains abstract methods.