This is the playbook which replaces param=[[number]] with newparam=19. 1.txt
test1 test2 param=13 test4
- name: Replace replace: path: ./1.txt regexp: '(param=)([0-9]{2}|[0-9]{1})' replace: 'newparam=19'