title: Remove characters after last occurrence of the character of a JSON key value
body: <p>I am trying to automate the deployment and invoke lambda function using ansible playbook.To get the arn of the lambda function,I wrote a json query. But here, I need only arn(arn:aws:lambda:us-west-2:1234567890:function:dev-Hello-World) but the Ansible script generates arn with version number (arn:aws:lambda:us-west-2:1234567890:function:dev-Hello-World:50). I used set_fact and json query to get the arn. But, I want to remove the version number and colon at the end. </p>
  
  <p>I tried to use regex and replace to remove the strings. I am new to JSON and programming.</p>
  
  <pre><code>- name: Get the Hello-world arn
    set_fact:
      populate_arn: "{{ Hello-World | json_query('results[0].configuration.function_arn')}}"
  
  - debug:
      var: populate_arn
  </code></pre>
  
  <p>Expected result:arn:aws:lambda:us-west-2:1234567890:function:dev-Hello-World</p>
  
  <p>Actual result: arn:aws:lambda:us-west-2:1234567890:function:dev-Hello-World:50</p>