Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Highlighted
Developer
Posts: 40
Registered: ‎09-03-2008
My Device: Not Specified

blackberry.pim.Contact.find does not support case insenstive

I am using blackberry.pim.Contact.find to search contacts and coudln't find a way to search the text  case insensitively.

I've tried to put '(?i)D' as the filter value and got error message.

 

var

fe = new blackberry.find.FilterExpression('firstName', "REGEX",

filter);

var results = blackberry.pim.Contact.find(fe);

 

After looking into the webworks code, I found the webworks uses javascript Regex object and does not passes the flag parameter. Does this mean that the find function not support case insentive search at all? Any way to work around?

 

public class PatternMatchingUtilities {

...

 

  public static boolean isMatch( ScriptEngine scriptEngine, String input, String regex ) {
        final String script = "(function patternMatches() { var pattern = new RegExp(\"" + regex + "\");" + "var input = \""
                + input + "\"; return pattern.test(input);})();";
        return ( (Boolean) scriptEngine.executeScript( script, null ) ).booleanValue();
    }

}

 

June