New Regex() inside an aggregation pipeline

Hi!
is there any way to use new RegExp() inside an aggregation pipeline for example

formulationRegex: new RegExp({$arrayElemAt:[{$split:[“$formulation”," "]},0]},“i”)

when I do this I get a result showing this:

formulationRegex: /[object Object]/i

Thanks,
Fernando