Re: [ansible-project] Issue while parsing Complex Regular expression in YAML file
The backslash must be escaped too (\\). For example, - debug: msg: OK loop: [' ', "'", '\', '"', '!', '}'] when: item is match(context_regex) vars: context_regex: '^[a-zA-Z0-9-+.#$%&~*/=?^_ ''\\"!]$' gives ok: [localhost] => (item= ) => { "msg": "OK" } ok: [localhost] => (item=') => { "msg": "OK" } ok: [localhost] => (item=\) => { "msg": "OK" } ok: [localhost] => (item=") => { "msg": "OK" } ok: [localhost] => (item=!) => { "msg": "OK" } skipping: [localhost] => (item=}) HTH, -vlado -- Vladimir Botka -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20200604094602.678af4a0%40gmail.com. pgpNwYdZ0Zjbu.pgp Description: OpenPGP digital signature
Re: [ansible-project] Issue while parsing Complex Regular expression in YAML file
On Wed, 3 Jun 2020 22:46:37 -0700 (PDT) Pawan Kumar wrote: > '^[a-zA-Z0-9-+.#$%&~*\/=?^_ '\"\\!]{9,430}$' Try this '^[a-zA-Z0-9-+.#$%&~*/=?^_''\"!]{9,430}$' In "single-quoted style" only the single-quote must be escaped ('') https://yaml.org/spec/1.2/spec.html#id2788097 For example (occurrences left out) - debug: msg: OK loop: ['a', '+', '}'] when: item is match(context_regex) vars: context_regex: '^[a-zA-Z0-9-+.#$%&~*/=?^_''\"!]$' gives ok: [localhost] => (item=a) => { "msg": "OK" } ok: [localhost] => (item=+) => { "msg": "OK" } skipping: [localhost] => (item=}) HTH, -vlado -- Vladimir Botka -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20200604092648.5ef145dd%40gmail.com. pgpyH76Pi3_hA.pgp Description: OpenPGP digital signature