search¶
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 C(search) function.
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 search("https://example.com/users/.*/resources")
alsomatch: url is search("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