hi all I don't get why the following regexp replacement matches
vars:
monit_pkgname: "prefixmonit-5.25.3-1"
tasks:
- name: debug
debug:
msg: "{{ monit_pkgname_release }}"
vars:
monit_pkgname_release: "{{
(monit_pkgname|regex_replace('(?<!prefix)monit-[0-9]+(?:\\.[0-9]+)*-([0-9]+)',
'\\1')).split('.') }}"
TASK [debug]
******************************************************************************************************************************************************************
ok: [capsule] => {
"msg": "[u'finecomonit-5', u'25', u'3-1']"
}
from regexp manual
(?<!...)Matches if the current position in the string is not preceded by a
match for .... This is called a *negative lookbehind assertion*.
The same happens with caret
vars:
monit_pkgname_version: "{{
(monit_pkgname|regex_replace('^monit-([0-9]+(?:\\.[0-9]+)*)-[0-9]+',
'\\1')).split('.') }}"
The aim would be made the replacement not happen if there's a prefix in
monit_pkgname-
any idea?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/63b6cd12-56a3-483b-9dfc-746180bc33c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.