knowledge/technology/tools/Ansible/tests/ansible.builtin.search.md
2023-12-04 11:02:23 +01:00

16 lines
No EOL
758 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ansible.builtin.search
Compare string against regular expression using Pythons `search` function.
## Parameters
| Parameter | Type | Description |
| -------------- | -------------------------- | --------------------------------------- |
| **ignorecase** | boolean (default: `false`) | Use case insenstive matching. |
| **multiline** | boolean (default: `false`) | Match against multiple lines in string. |
| **pattern** | string / required | Regex to match against. |
## Examples
```yml
url: "https://example.com/users/foo/resources/bar"
foundmatch: url is search("https://example.com/users/.*/resources")
alsomatch: url is search("users/.*/resources")
```