Is it possible to put an entity inside of a regex?
for example, giving that the entity "@pizza-toppings"
contains toppings:
"topping": "<? input.text.extract('(?i)\.+(@pizza-toppings)(?-i)', 1) ?>"
So, if @pizza-toppings
matches "onion", then "(?i)\.+(@pizza-toppings)(?-i)"
will be "(?i)\.+(onion)(?-i)"
. If it matches "cheese"
, then it will be "(?i)\.+(cheese)(?-i)"
and so on and so forth.
I've been trying to find a solution but so far I didn't find anything.
Without testing, after I noticed you were including the entity reference into the string. Try to do something like this:
"topping": "<? input.text.extract('(?i)\.+('+@pizza-toppings+')(?-i)', 1) ?>"