On Tue, Jun 3, 2014 at 6:50 PM, Roelof Wobben <r.wobben / home.nl> wrote:
>
> Op 3 juni 2014 om 18:36 schreef Andrew Vit <andrew / avit.ca>:
>
>
>
>
> On 14-06-02, 23:41, Robert Klemme wrote:
>> That depends on your input. Do you want to find those domain names in
>> a larger text? Do you try to parse URIs? Do you have full qualified
>> domain names from which you want to extract a portion?
>
> URI can extract from larger texts (URI.extract), parse URIs (URI.parse),
> and after that it's easy to split the domain parts from the
> fully-qualified hostnames. Really, I don't think there's any point in
> reinventing this using a Regexp... unless it's just a learning exercise.
>
> Andrew Vit
>
>
> This is a learning exercise from codewars.
>
> But I think I will use a regex for finding the full domain and then use
> split to find only the part before the .com and so on.
>
> I tried and I think its very difficult to find a regex which can solve all
> these problems.
>
>
> http:///www.tamarawobben.nl/index.html
>
> http://tamarawobben.nl/index.html
>
> http://<subdomain>.tamarawobben.nl/index.html
>
> where all three tamarawobben.nl must be found.
>
> Roelof

I tried to do it with a single regexp and I couldn't do anything
useful, so I tried to do it first with a regexp to extract the part
between the slashes (between http:// and the following /) and then use
split on "." to the result. This way is quite simpler. I'm not going
to give you the solution, so you can try a little bit this approach,
as this is a learning exercise.

Let me know if you get stuck.

Jesus.