2

It would be great to be able pass a caseSensitive option on the function call. By default it could be set to true (the current setup), but you could pass {caseSensitive: false} as the option param and it will return results in a case insensitive way.

I think this is something many users would find useful?

My use case is:

I have a list of properties that are in upper and lower case. I want the hint list itself to remain this way and if a user begins typing 'uhi', 'Uhi' or 'UHI', it would show hint results containing 'Uhi Property'.

I don't necessarily want it to alter the hint list to lowercase and is a bit messy for users to create code in the onChange event. Would be great if this was a standard option. :)

The Draw a Robot example on the complete.ly site (see: http://complete-ly.appspot.com/examples/draw.a.robot.html ) is the closest example here as it converts input & hint text to lower case but doesn't cover the above really as options list isn't lower case to begin with (Uhi Property) plus we don't especially want to convert the hint list to lower case either.

Thoughts appreciated.

Zo72
  • 14,593
  • 17
  • 71
  • 103
Matt Pass
  • 21
  • 1

1 Answers1

1

using match will do the job:

var string1 = "aBc";
var match = string1.match(/AbC/i);

if(match) {
}

where the 'i' stands for case insensitive

jbontinck
  • 432
  • 2
  • 5
  • 1
    to use variables in match u can use the constructor of Regexp: var re = new RegExp(variable, 'g'); xxx.match(re); – jbontinck Nov 22 '13 at 10:39