I have variable, its version numbering. How I catch last number in version
example
app_ver: 1.5.0.0.20
- debug:
var: app_ver | regex_search('^(\d+).(\d+).(\d+).(\d+).(\d+)$') | list
gives me
"app_ver |regex_search('^(\\d+).(\\d+).(\\d+).(\\d+).(\\d+)$') | list": [
"1",
".",
"5",
".",
"0",
".",
"0",
".",
"2",
"0"
]
I need last number, may be 1-figure or more
Split the line by . and take last element:
- debug:
msg: "{{ app_ver.split('.')[-1] }}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With