Is there a way to string replace with rules?
I'm trying to find some way to transform values without changing a value entirely.
Is there something I'm missing, or should I just make a custom rule that does string replace?
Is there a way to string replace with rules?
I'm trying to find some way to transform values without changing a value entirely.
Is there something I'm missing, or should I just make a custom rule that does string replace?
I used this for my incoming feeds, changing http:// to https://
{ "rules_http_to_https" : {
"LABEL" : "http to https",
"PLUGIN" : "reaction rule",
"ACTIVE" : false,
"OWNER" : "rules",
"REQUIRES" : [ "php", "rules", "feeds" ],
"ON" : { "feeds_import_canada_com" : [] },
"DO" : [
{ "data_set" : {
"data" : [ "node:body:value" ],
"value" : "\u003C?php\r\necho str_replace(\u0022http:\/\/\u0022 , \u0022https:\/\/\u0022, \u0022[node:body]\u0022 );\r\n?\u003E"
}
},
{ "data_set" : {
"data" : [ "node:field-contestpageurl" ],
"value" : "\u003C?php\r\necho str_replace(\u0022http:\/\/\u0022 , \u0022https:\/\/\u0022, \u0022[node:field-contestpageurl]\u0022 );\r\n?\u003E"
}
}
]
}
}