regex_search in validation #892
Answered
by
mvanholsteijn
mvanholsteijn
asked this question in
Q&A
-
In Issue #398, it is suggested that you can use jinja2 ansible filters to use a regex expression in a validation, but no example is given. The request in the issue thread was to ask a question here on the forum. So here it is: can you given an example of using a regex in a validation? |
Beta Was this translation helpful? Give feedback.
Answered by
mvanholsteijn
Dec 10, 2022
Replies: 1 comment 2 replies
-
So, I figured it out. Here is an example: resource_name:
type: str
help: The name of your custom resource?
validator: >-
{% if not (resource_name | regex_search('^Custom::[A-Z][a-zA-Z0-9]+$')) %}
Must be a CloudFormation custom type name, eg Custom::Custom.
{% endif %}
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
yajo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, I figured it out. Here is an example: