// (?<=^| )((?:(?:(?:https?|udp|tcp|ftp):\/\/)(?:(?:[^ ()]{2,}\.[^ ()]*)|(?:[^ ()]?\.[^ ()]+)))|(?:(?:www\.)(?:(?:\.[^ ()]{3,})|(?:\w\.[^ ()]{2,})|(?:[^ ()]{2,}\.[^ ()]+))))(?=$| ) // // Assert that the regex below can be matched, with the match ending at this position (positive lookbehind) «(?<=^| )» // Match either the regular expression below (attempting the next alternative only if this one fails) «^» // Assert position at the start of the string «^» // Or match regular expression number 2 below (the entire group fails if this one fails to match) « » // Match the character " " literally « » // Match the regular expression below and capture its match into backreference number 1 «((?:(?:(?:https?|udp|tcp|ftp):\/\/)(?:(?:[^ ()]{2,}\.[^ ()]*)|(?:[^ ()]?\.[^ ()]+)))|(?:(?:www\.)(?:(?:\.[^ ()]{3,})|(?:\w\.[^ ()]{2,})|(?:[^ ()]{2,}\.[^ ()]+))))» // Match either the regular expression below (attempting the next alternative only if this one fails) «(?:(?:(?:https?|udp|tcp|ftp):\/\/)(?:(?:[^ ()]{2,}\.[^ ()]*)|(?:[^ ()]?\.[^ ()]+)))» // Match the regular expression below «(?:(?:(?:https?|udp|tcp|ftp):\/\/)(?:(?:[^ ()]{2,}\.[^ ()]*)|(?:[^ ()]?\.[^ ()]+)))» // Match the regular expression below «(?:(?:https?|udp|tcp|ftp):\/\/)» // Match the regular expression below «(?:https?|udp|tcp|ftp)» // Match either the regular expression below (attempting the next alternative only if this one fails) «https?» // Match the characters "http" literally «http» // Match the character "s" literally «s?» // Between zero and one times, as many times as possible, giving back as needed (greedy) «?» // Or match regular expression number 2 below (attempting the next alternative only if this one fails) «udp» // Match the characters "udp" literally «udp» // Or match regular expression number 3 below (attempting the next alternative only if this one fails) «tcp» // Match the characters "tcp" literally «tcp» // Or match regular expression number 4 below (the entire group fails if this one fails to match) «ftp» // Match the characters "ftp" literally «ftp» // Match the character ":" literally «:» // Match the character "/" literally «\/» // Match the character "/" literally «\/» // Match the regular expression below «(?:(?:[^ ()]{2,}\.[^ ()]*)|(?:[^ ()]?\.[^ ()]+))» // Match either the regular expression below (attempting the next alternative only if this one fails) «(?:[^ ()]{2,}\.[^ ()]*)» // Match the regular expression below «(?:[^ ()]{2,}\.[^ ()]*)» // Match a single character NOT present in the list " ()" «[^ ()]{2,}» // Between 2 and unlimited times, as many times as possible, giving back as needed (greedy) «{2,}» // Match the character "." literally «\.» // Match a single character NOT present in the list " ()" «[^ ()]*» // Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*» // Or match regular expression number 2 below (the entire group fails if this one fails to match) «(?:[^ ()]?\.[^ ()]+)» // Match the regular expression below «(?:[^ ()]?\.[^ ()]+)» // Match a single character NOT present in the list " ()" «[^ ()]?» // Between zero and one times, as many times as possible, giving back as needed (greedy) «?» // Match the character "." literally «\.» // Match a single character NOT present in the list " ()" «[^ ()]+» // Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+» // Or match regular expression number 2 below (the entire group fails if this one fails to match) «(?:(?:www\.)(?:(?:\.[^ ()]{3,})|(?:\w\.[^ ()]{2,})|(?:[^ ()]{2,}\.[^ ()]+)))» // Match the regular expression below «(?:(?:www\.)(?:(?:\.[^ ()]{3,})|(?:\w\.[^ ()]{2,})|(?:[^ ()]{2,}\.[^ ()]+)))» // Match the regular expression below «(?:www\.)» // Match the characters "www" literally «www» // Match the character "." literally «\.» // Match the regular expression below «(?:(?:\.[^ ()]{3,})|(?:\w\.[^ ()]{2,})|(?:[^ ()]{2,}\.[^ ()]+))» // Match either the regular expression below (attempting the next alternative only if this one fails) «(?:\.[^ ()]{3,})» // Match the regular expression below «(?:\.[^ ()]{3,})» // Match the character "." literally «\.» // Match a single character NOT present in the list " ()" «[^ ()]{3,}» // Between 3 and unlimited times, as many times as possible, giving back as needed (greedy) «{3,}» // Or match regular expression number 2 below (attempting the next alternative only if this one fails) «(?:\w\.[^ ()]{2,})» // Match the regular expression below «(?:\w\.[^ ()]{2,})» // Match a single character that is a "word character" (letters, digits, etc.) «\w» // Match the character "." literally «\.» // Match a single character NOT present in the list " ()" «[^ ()]{2,}» // Between 2 and unlimited times, as many times as possible, giving back as needed (greedy) «{2,}» // Or match regular expression number 3 below (the entire group fails if this one fails to match) «(?:[^ ()]{2,}\.[^ ()]+)» // Match the regular expression below «(?:[^ ()]{2,}\.[^ ()]+)» // Match a single character NOT present in the list " ()" «[^ ()]{2,}» // Between 2 and unlimited times, as many times as possible, giving back as needed (greedy) «{2,}» // Match the character "." literally «\.» // Match a single character NOT present in the list " ()" «[^ ()]+» // Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+» // Assert that the regex below can be matched, starting at this position (positive lookahead) «(?=$| )» // Match either the regular expression below (attempting the next alternative only if this one fails) «$» // Assert position at the end of the string (or before the line break at the end of the string, if any) «$» // Or match regular expression number 2 below (the entire group fails if this one fails to match) « » // Match the character " " literally « »