# Extrapolate data from facts?

**URL:** <https://forum.ansible.com/t/extrapolate-data-from-facts/15710>\
**Category:** Ansible Project\
**Created:** [July 18, 2014, 9:01pm UTC](https://forum.ansible.com/t/extrapolate-data-from-facts/15710 "2014-07-18T21:01:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Oliver](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@John\_Oliver](https://forum.ansible.com/u/John_Oliver)\
**Post date:** [July 18, 2014, 9:01pm UTC](https://forum.ansible.com/t/extrapolate-data-from-facts/15710/1 "2014-07-18T21:01:39Z")

</div>

I would like to be able to test Macs for the major version of OS X, ie. Lion, Mountain Lion, Mavericks. I see a fact called “ansible\_distribution\_version” which is equal to the whole software rev, like “10.9.4” Can I have ansible perform some operation like cut or awk so I can wind up with “10.9” or “10.8”?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 18, 2014, 10:52pm UTC](https://forum.ansible.com/t/extrapolate-data-from-facts/15710/2 "2014-07-18T22:52:06Z")

</div>

You may be interested in the regex replace filter, as shown in the docs here:

[http://docs.ansible.com/playbooks\_variables.html#id26](http://docs.ansible.com/playbooks_variables.html#id26)

```auto
{{ 'foobar' | regex_replace('^f.*o(.*)$', '\1') }}

```

```auto

```

```auto

```
