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

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -