This IA is triggering for any query that ends in color <name> causing some irrelevant results.
e.g. https://duckduckgo.com/?q=symbolism+of+the+color+red&ia=answer
We need to verify that the query doesn't contain other words when the trigger is color
/cc @mintsoft
IA Page: http://duck.co/ia/view/color_codes
Maintainer: @Mailkov
@moollaza Ok, I'm working to solve it
Here's a visualization of the regex:

_source: https://www.debuggex.com/r/nAmQuV7VMZBpqOKF_
You can see that it's possible to have any string before "color red" because of the (.*?) in the regex...
@moollaza In this moment IA ColorCodes is supporting the queries "rgb color code for red" and "red color code for html" etc.
So I'm not sure I will change the regex ...
Maybe we need to be tighter with the regex and enforce "color code" being in the query, code not being optional?
@Mailkov I think we should break apart that big regex so it's easier to understand and then replace the (.*?) with words we actually expect to see.
Or maybe as a heuristic if the string doesn't contain "color code", but contains a named colour and other words, we should bail out?
@gaulrobe I'm not sure we want to be so strict as to require "color code" just yet. The IA is just a little too flexible with it's triggering right now.
@moollaza it might help to require it in cases where "color" is in the query, since that is gonna be very ambiguous. "color code" at least is explicit in what is being asked. But either way, maybe too early to go that far. :smile:
@gaulrobe ah sorry I misunderstood you!
It looks like there are a few common search forms that just contain color though...


An alternative approach is to remove words and phrases we expect to be in the query and if the result is a valid colour name or code then we could trigger.
Ultimately I think we need to break up the logic we use to evaluate the query so it's easier to reason about, and then add more tests!
BTW I just noticed that "#E0E0E0 color" and "#E0E0E0 css color" don't trigger this Instant Answer -- they definitely should!
@moollaza good catch
@Mailkov Have you got a fork in progress somewhere? I don't mind picking this up if you don't have time
@mintsoft If you do, some of the test queries from #3346 might be useful to ensure it isn't over-triggering.
Ping! I'm just checking in to see if anyone is still interested in finishing this one up?
color: "your color";
or
backgroundbg color: " your color";
Most helpful comment
@gaulrobe ah sorry I misunderstood you!
It looks like there are a few common search forms that just contain

colorthough...An alternative approach is to remove words and phrases we expect to be in the query and if the result is a valid colour name or code then we could trigger.
Ultimately I think we need to break up the logic we use to evaluate the query so it's easier to reason about, and then add more tests!