^replace inside ^replace_keywords


(Nathan Irwin) #1

I'm using a regular expression asset to replace keywords based on if my search box (omni) has two words or just one

 

%globals_get_omni^preg_match:123123^gte:1:=foo:=bar%

 

more than one word in omni: =foo

and if not: =bar

 

 

 

But so let say we go for the the ^replace keyword instead of =bar:

 

%globals_get_omni^preg_match:123123^replace_keyword^gte:1:=foo:={globals_get_omni}%

 

more than one word in omni: =foo

 

single word in omni is bear

returns: =bear

 

Everything works fine up till here.

 

 

 

Now the issue. Let say we want to add a ^replace the {globals_get_omni}:

 

%globals_get_omni^preg_match:123123^replace_keyword^gte:1:=foo:={globals_get_omni}^urlencode^replace:(bear):awesomebear%

 

Nope. Just fails. No awesomebear.

 

I've tried moving the ^replace to inside the {} but that doesnt work either....

 

Maybe I've gone down the wrong track on this...

 


(Bart Banda) #2

Wow, epic modifier. The modifier inside the {} or just after it doesn't work, it has been reported as a bug but has not been fixed yet. You can only do a modifier on it outside of the keyword modifier before it. You also need an s at the end of replace_keyword(s). 

 

Does 

 

%globals_get_omni^preg_match:123123^replace_keywords^gte:1:=foo:={globals_get_omni}^urlencode%

 

Work?