github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/funcs/md/match.en.md (about)

     1  ### `match()` {#fn-match}
     2  
     3  Function prototype: `fn match(pattern: str, s: str) bool`
     4  
     5  Function description: Use the specified regular expression to match the string, return true if the match is successful, otherwise return false
     6  
     7  Function parameters:
     8  
     9  - `pattern`: regular expression
    10  - `s`: string to match
    11  
    12  Example:
    13  
    14  ```python
    15  # script
    16  test_1 = "pattern 1,a"
    17  test_2 = "pattern -1,"
    18  
    19  add_key(match_1, match('''\w+\s[,\w]+''', test_1)) 
    20  
    21  add_key(match_2, match('''\w+\s[,\w]+''', test_2)) 
    22  
    23  # result
    24  {
    25      "match_1": true,
    26      "match_2": false
    27  }
    28  ```