1

Using Drupal 7, I'm creating nodes by email using Feeds and Mailhandler. The body of the email is mapped to the body of the node. I'd like to trim the text to eliminate boilerplate language from the email so that it's not in the body of the node. I can't initiate the trim on a character or word count, because that will vary with each email. Is there a module, or a method in either Rules or Feed Tamper, by which I can initiate a trim when encountering a particular text string? If not, is there another method (like rewriting the string) that would achieve this? Thanks!

1 Answer 1

0

I'm answering my own question... To eliminate a text string in an imported node, I used the Feeds Tamper "find replace regex" plugin on the node's body.The regex to find was:

/(?=FirstWord )(.*)(?<=LastWord[.])/s

Where FirstWord was the first word of the string to be eliminated, and LastWord[.] represented the last word of the string followed by a period. If you don't want to include punctuation, eliminate the [.] completely.

The trailing "s" indicates "single line mode," which makes the dot (before the asterisk) match all characters, including line breaks.

Of course, the replacement value was empty.

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.