Do you want to extract the strings from the comment, or do you just want to
get the three attributes (last_name, mid_name etc) in some particular order?

You can get the parts of the name out of the comment by using the split()
filter. This assumes no names contain spaces or whatever split delimiter
you use - not a good assumption. Ask Charles de Gaulle.

There is no automatable way to reliably work out what order the parts of a
name should be in. Some cultures are firstname, lastname, some are lastname
firstname, some are one in some circumstances and the other way in other
circumstances, some routinely have three parts, or only one part. Even in
the English-speaking world there are zillions of exceptions like J. Edgar
Hoover or Fred Smith Junior.

Regards, K


On Mon, Feb 10, 2020 at 2:34 PM Eric Chang <[email protected]> wrote:

> I have a list like this
>
> user:
>   name: chchang
>   comment: "Chang Chic Hung"
>
> and I want to add more attrs like
>
> last_name: Chang
> mid_name: Chic
>
> but how to get the specifed order of the values ?
> I try  to use filter "first" , but it just return "C" , the first letter ,
> not the first word.
>
> any suggestions ?
>
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/cd62f864-de01-4d5c-8829-47607bd5b626%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/cd62f864-de01-4d5c-8829-47607bd5b626%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

*Karl Auer* { manager, systems support }
P: 1300 759 975
E: [email protected]
2pisoftware.com

GPG/PGP : 301B 1F4E 624D AD99 242C 7A68 EC24 7113 E854 4A4E
Previous: 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08Q8bo5SyBGnW_GkHtTJKDnoGdzk%2BOexhC7Q7-bzt%3DA8ow%40mail.gmail.com.

Reply via email to