Documentation ¶
Index ¶
Constants ¶
const ( RuRegex = `(^8|7|\+7)((\d{10})|(\s\(\d{3}\)\s\d{3}\s\d{2}\s\d{2}))` USRegex = `\(?\d{3}\)?-? *\d{3}-? *-?\d{4}` DERegex = `[^\d]((\+49|0049|0)[\s]?1[567]\d{1,2}([ \-/]*\d){7})` NLRegex = `(?:(?:\+31|0|0031)[\s-]?\d{1,3}[\s-]?\d{6,7}|06[\s-]?\d{8})` )
Variables ¶
This section is empty.
Functions ¶
func FindTelTagPhones ¶
FindTelTagPhones is the primary function for searching for phone numbers in a webpage. It can search for href tel tags and input type tel tags, combining them and returning results separated by a space as a string for further classification of the phone number.
func MapCountryCodeToRegex ¶
MapCountryCodeToRegex maps each countryCode to the specific regexp
Types ¶
type PhoneNumberFinder ¶
type PhoneNumberFinder interface { FindPhoneNumbers(html string) []string FormatAndCreateNumbers(webPageId int, phoneNumbers []string) error }
PhoneNumberValidator is an implementation of PhoneNumberMatcher for a specific country.
type PhoneNumberValidator ¶
type PhoneNumberValidator struct {
// contains filtered or unexported fields
}
func NewPhoneNumberValidator ¶
func NewPhoneNumberValidator(regexPattern string, countryCode string) (*PhoneNumberValidator, error)
NewPhoneNumberValidator creates a new instance of PhoneNumberValidator.
func (*PhoneNumberValidator) FindPhoneNumbers ¶
func (c *PhoneNumberValidator) FindPhoneNumbers(html string) []string
func (*PhoneNumberValidator) FormatAndCreateNumbers ¶
func (p *PhoneNumberValidator) FormatAndCreateNumbers(webPageId int, phoneNumbers []string)
FormatAndCreateNumbers Validates phone numbers and returns a list of validated phone numbers with as much information as possible From libphonenumbers Function is not perfect and may sometimes fail
type PhoneProcessor ¶
type PhoneProcessor struct {
// contains filtered or unexported fields
}
func NewPhoneProcessor ¶
func NewPhoneProcessor() *PhoneProcessor
func (*PhoneProcessor) ProcessPhoneNumbers ¶
func (p *PhoneProcessor) ProcessPhoneNumbers(html string, webPageID int, patterns map[string]string)
ProcessPhoneNumbers processes phone numbers in HTML content using specified patterns for different countries.
func (*PhoneProcessor) SetCountryRegex ¶
func (p *PhoneProcessor) SetCountryRegex(countryCode, regexPattern string)