Regex Grouping (Retrieve subdomain) -
i'm trying write regex match url subdomain excluding "www". trying retrieve subdomain after match can't seem group correctly. first group matches whole url. allow lower case letters, numbers , "-" in subdomain. need retrieve subdomain if pattern matches
^(((?!www)[a-z0-9\\-]*))+(\\.)+?example\\.com.*$
/^(?!www)([a-z0-9\-]+)\.example\.com.*$/
group 0 have whole url, , group 1 contain subdomain
Comments
Post a Comment