Hi Ed,
Here's what Regex Buddy tells me your Regex is checking for. I suspect that the first group (.{1,254}$) is still wrong - maybe the example you found wasn't in JavaScript format?
Bob
FQDN test
^(.{1,254}$)(^(?:(?!\d+.)[a-zA-Z0-9_-]{1,63}.?)+(?:[a-zA-Z]{2,})$
Options: Case sensitive; ^$ match at line breaks
Assert position at the beginning of a line (at beginning of the string or after a line break character) (line feed, line feed, line separator, paragraph separator) «^»
Match the regex below and capture its match into backreference number 1 «(.{1,254}$)»
Match any single character that is NOT a line break character (line feed, carriage return, line separator, paragraph separator) «.{1,254}»
Between one and 254 times, as many times as possible, giving back as needed (greedy) «{1,254}»
Assert position at the end of a line (at the end of the string or before a line break character) (line feed, line feed, line separator, paragraph separator) «$»
Opening parenthesis without a corresponding closing parenthesis «(^(?:(?!\d+.)[a-zA-Z0-9_-]{1,63}.?)+(?:[a-zA-Z]{2,})$»
Assert position at the beginning of a line (at beginning of the string or after a line break character) (line feed, line feed, line separator, paragraph separator) «^»
Match the regular expression below «(?:(?!\d+.)[a-zA-Z0-9_-]{1,63}.?)+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Assert that it is impossible to match the regex below starting at this position (negative lookahead) «(?!\d+.)»
Match a single character that is a “digit” (ASCII 0–9 only) «\d+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Match any single character that is NOT a line break character (line feed, carriage return, line separator, paragraph separator) «.»
Match a single character present in the list below «[a-zA-Z0-9_-]{1,63}»
Between one and 63 times, as many times as possible, giving back as needed (greedy) «{1,63}»
A character in the range between “a” and “z” (case sensitive) «a-z»
A character in the range between “A” and “Z” (case sensitive) «A-Z»
A character in the range between “0” and “9” «0-9»
The literal character “_” «_»
The literal character “-” «-»
Match any single character that is NOT a line break character (line feed, carriage return, line separator, paragraph separator) «.?»
Between zero and one times, as many times as possible, giving back as needed (greedy) «?»
Match the regular expression below «(?:[a-zA-Z]{2,})»
Match a single character present in the list below «[a-zA-Z]{2,}»
Between 2 and unlimited times, as many times as possible, giving back as needed (greedy) «{2,}»
A character in the range between “a” and “z” (case sensitive) «a-z»
A character in the range between “A” and “Z” (case sensitive) «A-Z»
Assert position at the end of a line (at the end of the string or before a line break character) (line feed, line feed, line separator, paragraph separator) «$»
Created with RegexBuddy