Reputation: 1274
There is a problem in java script regular expression .I want my regular expression should be dynamic and it match the string with starting characters.This issue happens in auto complete
Example:
var myString = "tester Developer" ;
variable = values which typed in input fields;
var regExp = ('^' + variable + '$');
This regExp is change when user type a character.. if user types ' t' (or) 'te' (or) 'tes' ... it returns true. if 'td','ht','fd'(which is not a starting letter of myString) it returns false..
Upvotes: 0
Views: 350
Reputation: 3965
I think what you are looking for is this:
var re = new RegExp("ab+c");
See this for a more detailed explanation: https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions
Upvotes: 1