Dear,
I tried to use the module on an html string, but it seems that it remove any html tag.
My test was to use it on a body content.
the result string was empty from any html tags ans attributes.
How could I do to use it on an html content ?

regards

Comments

superlolo95 created an issue. See original summary.

geek-merlin’s picture

Category: Feature request » Support request
Status: Active » Fixed

The module is just a wrapper around the preg_replace function.

You can debug your regular expressions with something like this:
https://de.functions-online.com/preg_replace.html

To get help with further regex questions, consider here:
http://stackoverflow.com/

superlolo95’s picture

Dear,
I used the same pattern in my rule with a php action ("Execute custom PHP code") that is like below (without the php delimiters):

$pattern = '/style\s*=\s*"\s*(.+\s*)\s*(;\s*.+\s*)*"/i';
$replacement = '';
$node->body["und"][0]["value"] = preg_replace($pattern, $replacement, $node->body["und"][0]["value"]);

In the php action, this is working well. Html tags and attributes are kept.
With the module, with the same pattern, the html tags are removed. Only the text remains.

Note:
My rules is supposed to remove html style attributes from the body value before saving for a specific node type.

Regards

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.