Skip to content

Wildcards broken? #6

@flowchartsman

Description

@flowchartsman

This library does not properly parse wildcards, it seems:

Using the following code:

package main
import (
    "github.com/joeguo/tldextract"
    "fmt"
)

func main() {
    var test string
    var err error
    tld, _:= tldextract.New("/tmp/tldcache.txt",false)

    for err == nil {
        fmt.Printf("string: ")
        fmt.Scanf("%s\n", &test)
        result := tld.Extract(test)
        if result.Flag == tldextract.Malformed {
            fmt.Println("Error", result)
        } else {
            fmt.Printf("%s.%s\n", result.Root, result.Tld)
        }
    }
}

I get:

string: http://foo.bar.com
bar.com
string: http://foo.co.uk
Error &{0   }
string: http://foo.*.uk
foo.*.uk

The "foo.*.uk" is most certainly incorrect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions