parent
0c5bc7bf32
commit
8d2f6c31de
1 changed files with 5 additions and 1 deletions
|
@ -37,7 +37,7 @@ Such as::
|
||||||
Testing strings
|
Testing strings
|
||||||
```````````````
|
```````````````
|
||||||
|
|
||||||
To match strings against a substring or a regex, use the "match" or "search" filter::
|
To match strings against a substring or a regular expression, use the "match", "search" or "regex" filters::
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
url: "http://example.com/users/foo/resources/bar"
|
url: "http://example.com/users/foo/resources/bar"
|
||||||
|
@ -55,6 +55,10 @@ To match strings against a substring or a regex, use the "match" or "search" fil
|
||||||
msg: "matched pattern 3"
|
msg: "matched pattern 3"
|
||||||
when: url is search("/users/")
|
when: url is search("/users/")
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "matched pattern 4"
|
||||||
|
when: url is regex("example.com/\w+/foo")
|
||||||
|
|
||||||
'match' requires a complete match in the string, while 'search' only requires matching a subset of the string.
|
'match' requires a complete match in the string, while 'search' only requires matching a subset of the string.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue