I have an expression that works exactly how I need it, but using the expression editor it seem the “/s” flag doesn’t work at all.
is this something that can be added, or something I’m missing?
I have an expression that works exactly how I need it, but using the expression editor it seem the “/s” flag doesn’t work at all.
is this something that can be added, or something I’m missing?
Hey @RedPacketSec, expressions can be a bit picky when it comes to certain JS constructs unfortunately. In such cases you might want to go for the Function or Function Item node instead, where regular expression work fine:
cheers will give it a go, this is where i fall over “function nodes” as my code writing isnt as strong
I’ll get there, thanks for the advice.
The function item should be a lot easier to deal with. As it doesnt require you to keep the item structure in mind.
do you any examples where you can take the json from the node before
e.g. json.article_body
and then show how in a function node you would use a regex to replace this bit of HTML class ? would be super handy
Yes for the regex, not sure about the second question.
let regex = /somekindaregex/m;
item.field= item.text.match(regex)[0].trim();
ill have a play
i just remembered i had this post
but it doesnt work anymore for this, just says
content.replace is not a function
i think this is due to it not being a string, so i made some progress and it executed, but now all results say undefined, so now working on that,
ahh typo , think its working now