# register expressions

**URL:** <https://forum.ansible.com/t/register-expressions/12164>\
**Category:** Ansible Project\
**Created:** [December 26, 2012, 5:46pm UTC](https://forum.ansible.com/t/register-expressions/12164 "2012-12-26T17:46:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rektide](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@rektide](https://forum.ansible.com/u/rektide)\
**Post date:** [December 26, 2012, 5:46pm UTC](https://forum.ansible.com/t/register-expressions/12164/1 "2012-12-26T17:46:45Z")

</div>

Greets ansible,

I'm interested in the development of a way to extract specific pieces of data when doing a  
"register:" directive on a command. I seem to have a lot of ${foo.stdout} code littered  
around, which first, is really problematic because I can not interchangably use either a  
register:'ered variable or a plain-old-variable unless I mock out my plain-old-variable as a  
dictionary with a stdout property (vars:\ myfoo:\ stdout: myvalue).

That is my specific problem at the moment. I can imagine a register expression as one  
particular answer to this problem:

- shell: echo hi ansible-project  
&nbsp;&nbsp;register: expression=$registrant.stdout myhello

Here, the register directive gets an expression argument which Read-Evaluates-Replaces the  
original thing it got in, transforming a complex shell-results object with a string, it's  
stdout.

Finding a way to munge together the right variables has been the #1 thing that's still work  
on my part in Ansible. Most everything else seems to come already working. 🙂

(This was initially files as issue #1730, [https://github.com/ansible/ansible/issues/1730](https://github.com/ansible/ansible/issues/1730),  
'"register" expressions' and moved here per request of Mr DeHann.)

Cheers all!  
- @rektide
