gitlab.com/evatix-go/core@v1.3.55/cmd/main/lazyRegExTester01.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"sync"
     6  
     7  	"gitlab.com/evatix-go/core/regexnew"
     8  )
     9  
    10  func lazyRegExTester01() {
    11  
    12  	patterns := []string{
    13  		"something",
    14  		"\\d+",
    15  		"\\d+",
    16  		"something",
    17  		"something",
    18  		"something",
    19  		"something",
    20  		"something",
    21  		"something",
    22  		"something",
    23  		"something",
    24  		"something",
    25  		"something",
    26  		"5",
    27  		"something",
    28  		"something",
    29  		"something",
    30  		"4",
    31  		"1",
    32  		"2",
    33  		"3",
    34  	}
    35  
    36  	wg := sync.WaitGroup{}
    37  	wg.Add(len(patterns))
    38  
    39  	genFunc := func(index int, p string) {
    40  		fmt.Println(index, p, " --- getting created")
    41  		lazyRegex := regexnew.New.LazyLock(p)
    42  
    43  		fmt.Println(index, lazyRegex.FullString())
    44  
    45  		wg.Done()
    46  	}
    47  
    48  	for i, pattern := range patterns {
    49  		go genFunc(i, pattern)
    50  	}
    51  
    52  	wg.Wait()
    53  }