match¶
Collection Note
This module is part of the ansible.builtin collection. To install the collection, use:
Synopsis¶
- Compare string against regular expression using Python's match function, this means the regex is automatically anchored at the start of the string.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| _input string required |
String to match. | |
| ignorecase boolean |
Use case insensitive matching. | |
| multiline boolean |
Match against multiple lines in string. | |
| pattern string required |
Regex to match against. |
Examples¶
url: "https://example.com/users/foo/resources/bar"
foundmatch: url is match("https://example.com/users/.*/resources")
nomatch: url is match("/users/.*/resources")
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| _value | boolean | Returns V(True) if there is a match, V(False) otherwise. |
Authors¶
- Ansible Core