Regex to extract subdomain from URL?

后端 未结 7 2472
名媛妹妹
名媛妹妹 2020-12-05 15:07

I have a bunch of domain names coming in like this:

http://subdomain.example.com (example.com is always example.com, but the subdomain varies).

I need \"subd

7条回答
  •  感情败类
    2020-12-05 15:52

    It should just be

    \Qhttp://\E(\w+)\.domain\.com
    

    The sub domain will be the first group.

提交回复
热议问题