September 29, 2011

I was having some fun with the Sitecore (6.5.0.110818) rules engine over the last couple days. Specifically, I was trying to show content editor warnings as well as control icons for templates based on the name of the item. However the Item name comparison, when using a regular expression, was never evaluating to true.

Upon inspection of

Sitecore.Rules.Conditions.StringOperatorCondition<T>

I noticed that the RegEx call has the parameters flip-flopped! This means that any condition that uses the RegEx String Operator to compare will fail (assuming your regular express isn't exacly the string you are matching). The list of problem conditions is:

Item Id

Item Name

Item Path

Language

Parent Name

Domain Name

User Name

User Profile

Database Name

Device Name

Website Name

When Field

Being I was only working with the Item Name condition I re-wrote it as such: