go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/core/resources/regex.go (about)

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package resources
     5  
     6  import "go.mondoo.com/cnquery/providers/core/resources/regex"
     7  
     8  func (p *mqlRegex) id() (string, error) {
     9  	return "time", nil
    10  }
    11  
    12  func (p *mqlRegex) ipv4() (string, error) {
    13  	return regex.IPv4, nil
    14  }
    15  
    16  func (p *mqlRegex) ipv6() (string, error) {
    17  	// This needs a better approach, possibly using advanced regex features if we can...
    18  	return regex.IPv6, nil
    19  }
    20  
    21  // TODO: needs to be much more precise
    22  func (p *mqlRegex) url() (string, error) {
    23  	return regex.Url, nil
    24  }
    25  
    26  func (p *mqlRegex) domain() (string, error) {
    27  	return regex.UrlDomain, nil
    28  }
    29  
    30  // TODO: this needs serious work! re-use aspects from the domain recognition
    31  func (p *mqlRegex) email() (string, error) {
    32  	return regex.Email, nil
    33  }
    34  
    35  func (p *mqlRegex) mac() (string, error) {
    36  	return regex.MAC, nil
    37  }
    38  
    39  func (p *mqlRegex) uuid() (string, error) {
    40  	return regex.UUID, nil
    41  }
    42  
    43  func (p *mqlRegex) emoji() (string, error) {
    44  	return regex.Emoji, nil
    45  }
    46  
    47  func (p *mqlRegex) semver() (string, error) {
    48  	return regex.Semver, nil
    49  }
    50  
    51  func (p *mqlRegex) creditCard() (string, error) {
    52  	return regex.CreditCard, nil
    53  }