I have a shell task that registers data that looks similar to:

"stdout_lines": [
    "username\tuserem...@domain.tld", 
    "username\tuserem...@domain.tld", 
    "username\tuserem...@domain.tld", 
    "username\tuserem...@domain.tld", 
...,
]

What I'd really like to end up with is a variable that contains a list/has 
similar to { username: "username", emailprefix: "useremail", emaildomain: 
"domain.tld" }, { username: "username", emailprefix: "useremail", 
emaildomain: "domain.tld" }, ... { username: "username", emailprefix: 
"useremail", emaildomain: "domain.tld" }

Currently I've been trying to get the "useremail" part of each of those 
lines out so I can do something with it.

So far I've tried using this regex "\\t[a-zA-Z-]+@" and the regex_replace 
and match jinja filters.

match returns true or false as far as I can tell.

regex_replace lets me easily replace "useremail" with something, but not 
actually get "useremail" out of it.

For example, I can replace "useremail" with a space like this:

- debug: msg="{{ item|regex_replace('\\t[a-zA-Z-]+@',' ') }}"
  with_items: userinfo.stdout_lines

But that's not very helpful....

Any suggestions on how I can get what I want?

Note that the regex above also matches the \t and @ characters when tested 
on regexpal.com.


-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dfccd18c-0d4c-4fa6-a984-4bc529f6845d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to