-
| 
         Currently I have something like  
 BUT NOT 
  | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            bioball
          
      
      
        Feb 19, 2025 
      
    
    Replies: 2 comments 1 reply
-
| 
         I guess you have to wait for apple/pkl-evolution#13
 
…On Wed, Feb 19, 2025, 11:18 AM Kai Hendry ***@***.***> wrote:
 Currently I have something like tenant: String; // a TLD domain. Any
 suggestions how I can make sure it's a domain like:
    - example.com
    - foo.example.com
    - a.b.c.example.com
 BUT NOT
    - example.com/a/b/c
    - example.com/foo
    - https://example.com/
 —
 Reply to this email directly, view it on GitHub
 <#967>, or unsubscribe
 <https://github.com/notifications/unsubscribe-auth/ACOBQ6ZQLS42HODYPEETM5L2QRLABAVCNFSM6AAAAABXNZI4QOVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXHE4DSMBXGA>
 .
 You are receiving this because you are subscribed to this thread.Message
 ID: ***@***.***>
 
 | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| 
         You can use a type constraint to describe what a valid domain name is. Took this regex from https://stackoverflow.com/a/26987741: typealias DomainName = String(matches(Regex(#"(((?!-))(xn--|_)?[a-z0-9-]{0,61}[a-z0-9]{1,1}\.)*(xn--)?([a-z0-9][a-z0-9\-]{0,60}|[a-z0-9-]{1,30}\.[a-z]{2,})"#)))
tenant: DomainName | 
  
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            
      Answer selected by
        kaihendry
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
You can use a type constraint to describe what a valid domain name is.
Took this regex from https://stackoverflow.com/a/26987741: