I notice that Drupal Rules Data Transforms has the "trim text" action option. Is it possible to trim the returned value by a specific number of characters, or remove a specific word from the returned string?

E.g. I grab an entity field value with my first action, and I want to remove the word "grams" from the returned value.

1 Answer 1


You can try applying this Rules Data Transforms replace text patch which adds the ability to replace text. Flush cache after applying patch.

So now simply replace grams with nothing (empty).

  • I applied the patch succesfully, and it provides the action 'replace text'. However when I select it, I get an empty screen and the error 'Unknown action replace_text'.
    – Brittany
    Apr 11, 2018 at 5:29
  • @Brittany Did you flush your cache after applying the patch?
    – No Sssweat
    Apr 11, 2018 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.