I have a list of strings called somelist as shown below. How do I specify a regex to search for the string name: bob - note that this should not match with name: bobby. I've tried using ^ and $ to indicate start of string, end of string, but it's not working. Also the colon is causing the following error: syntax error - mapping values are not allowed in this context. I can't figure out how to escape the colon. Thank you!
---
- hosts: localhost
vars:
somelist:
- "name: greg"
- "name: bobby"
- "name: joe"
tasks:
- debug: msg='{{ somelist is search("^name: bob$") }}' # <--- this should equate to false
- debug: msg='{{ somelist is search("^name: bobby$") }}' # <--- this should equate to true