0

I am getting SyntaxError: trailing \ in regular expression in the below line, when i gave

the input like "xyz\" to the text-box.

var re = new RegExp(searchfield.getRawValue(), "ig")

I have added this line to make input as case insensitive.

Can somebody tell me how to handle this?

Note: I am not familiar about regular expression.

Renganathan M G
  • 5,039
  • 2
  • 31
  • 35

1 Answers1

0

In RegExp, the flag parameter is to specify options for the matching pattern. For example in RegExp([a-z], "i"), parameter for pattern "[a-z]" matches lower case alphabets and second parameter "i" makes the pattern ignore case. Now this regexp matches lower as well as upper case alphabets.

Please explain more on what you are trying to achieve using RegExp in your case..

[Edit] Try using maskRe: /[a-zA-Z]/ to accept only alphabets, but case insensitive

newmount
  • 1,921
  • 1
  • 12
  • 10
  • Here i am trying to make user inputs as case insensitive. I want to achieve like User can enter any value to the text-box without any error. – Renganathan M G Apr 01 '14 at 10:52