Debian Codegraph @

lib/ansible/plugins/test/regex.yml

raw
1 DOCUMENTATION:
2 name: regex
3 author: Ansible Core
4 short_description: Does string match regular expression from the start
5 description:
6 - Compare string against regular expression using Python's match, fullmatch or search functions.
7 options:
8 _input:
9 description: String to match.
10 type: string
11 required: True
12 pattern:
13 description: Regex to match against.
14 type: string
15 required: True
16 ignorecase:
17 description: Use case insensitive matching.
18 type: boolean
19 default: False
20 multiline:
21 description: Match against multiple lines in string.
22 type: boolean
23 default: False
24 match_type:
25 description:
26 - Decide which function to be used to do the matching.
27 type: string
28 choices: [match, search, fullmatch]
29 default: search
30
31 EXAMPLES: |
32 - name: check if string matches regex
33 assert:
34 that:
35 - 'url is regex("example\.com/\w+/foo")'
36 vars:
37 url: "https://example.com/users/foo/resources/bar"
38
39 - name: check if string matches regex ignoring case
40 assert:
41 that:
42 - 'url is regex("EXAMPLE\.COM/\w+/foo", ignorecase=True)'
43 vars:
44 url: "https://Example.com/users/foo/resources/bar"
45
46 RETURN:
47 _value:
48 description: Returns V(True) if there is a match, V(False) otherwise.
49 type: boolean